Mercurial > hg > octave-lojdl
changeset 16021:26cba49d7641
Prevent extra newline in history list when --no-line-editing option used.
* liboctave/util/cmd-hist.cc(gnu_history::do_add): Strip newline before adding
line to history list.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 08 Feb 2013 15:46:45 -0800 |
parents | 1e35b64ac31a |
children | d8f216d241cf |
files | liboctave/util/cmd-hist.cc |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/cmd-hist.cc +++ b/liboctave/util/cmd-hist.cc @@ -192,8 +192,14 @@ if (s.empty () || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n'))) return; + + // Strip newline before adding to list + std::string stmp = s; + int stmp_len = stmp.length (); + if (stmp[stmp_len - 1] == '\n') + stmp.resize (stmp_len - 1); - lines_this_session += ::octave_add_history (s.c_str (), history_control); + lines_this_session += ::octave_add_history (stmp.c_str (), history_control); } }