Mercurial > hg > octave-nkf
changeset 19573:f7ccd02bc060 gui-release
provide access to the readline variable rl_erase_empty_line
* cmd-edit.h, cmd-edit.cc (command_editor::erase_empty_line,
command_editor::do_erase_empty_line,
gnu_readline::do_erase_empty_line): New functions.
* oct-rl-edit.h, oct-rl-edit.c (octave_rl_erase_empty_line):
New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 04 Dec 2014 15:56:49 -0500 |
parents | 302eef6de090 |
children | c1ce43276b86 |
files | liboctave/util/cmd-edit.cc liboctave/util/cmd-edit.h liboctave/util/oct-rl-edit.c liboctave/util/oct-rl-edit.h |
diffstat | 4 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.cc +++ b/liboctave/util/cmd-edit.cc @@ -108,6 +108,8 @@ void do_blink_matching_paren (bool flag); + bool do_erase_empty_line (bool flag); + void do_set_basic_word_break_characters (const std::string& s); void do_set_completer_word_break_characters (const std::string& s); @@ -379,6 +381,12 @@ ::octave_rl_enable_paren_matching (flag ? 1 : 0); } +bool +gnu_readline::do_erase_empty_line (bool flag) +{ + return ::octave_rl_erase_empty_line (flag ? 1 : 0); +} + void gnu_readline::do_set_basic_word_break_characters (const std::string& s) { @@ -1177,6 +1185,12 @@ instance->do_blink_matching_paren (flag); } +bool +command_editor::erase_empty_line (bool flag) +{ + return instance_ok () ? instance->do_erase_empty_line (flag) : false; +} + void command_editor::set_basic_word_break_characters (const std::string& s) {
--- a/liboctave/util/cmd-edit.h +++ b/liboctave/util/cmd-edit.h @@ -91,6 +91,8 @@ static void blink_matching_paren (bool flag); + static bool erase_empty_line (bool flag); + static void set_basic_word_break_characters (const std::string& s); static void set_completer_word_break_characters (const std::string& s); @@ -262,6 +264,8 @@ virtual void do_blink_matching_paren (bool) { } + virtual bool do_erase_empty_line (bool) { return false; } + virtual void do_set_basic_word_break_characters (const std::string&) { } virtual void do_set_completer_word_break_characters (const std::string&) { }
--- a/liboctave/util/oct-rl-edit.c +++ b/liboctave/util/oct-rl-edit.c @@ -74,6 +74,14 @@ rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); } +int +octave_rl_erase_empty_line (int val) +{ + int retval = rl_erase_empty_line; + rl_erase_empty_line = val; + return retval; +} + /* It would be much simpler if we could just call _rl_clear_screen to only clear the screen, but it is not a public function, and on some systems, it is not exported from shared library versions of