Mercurial > hg > octave-nkf
diff liboctave/cmd-edit.cc @ 3215:bc3fdfe311a3
[project @ 1998-11-10 14:06:21 by jwe]
author | jwe |
---|---|
date | Tue, 10 Nov 1998 14:12:07 +0000 |
parents | bef7b73c0724 |
children | 30770ba4457a |
line wrap: on
line diff
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -114,6 +114,10 @@ void do_restore_startup_hook (void); + void do_set_event_hook (fcn f); + + void do_restore_event_hook (void); + void do_read_init_file (const string& file); static void operate_and_get_next (int, int); @@ -122,6 +126,8 @@ fcn previous_startup_hook; + fcn previous_event_hook; + completion_fcn completion_function; static char *command_generator (const char *text, int state); @@ -130,7 +136,8 @@ }; gnu_readline::gnu_readline () - : command_editor (), previous_startup_hook (0), completion_function (0) + : command_editor (), previous_startup_hook (0), + previous_event_hook (0), completion_function (0) { rl_initialize (); @@ -326,6 +333,20 @@ } void +gnu_readline::do_set_event_hook (fcn f) +{ + previous_event_hook = rl_event_hook; + + rl_event_hook = f; +} + +void +gnu_readline::do_restore_event_hook (void) +{ + rl_event_hook = previous_event_hook; +} + +void gnu_readline::do_read_init_file (const string& file) { if (file.empty ()) @@ -662,6 +683,20 @@ } void +command_editor::set_event_hook (fcn f) +{ + if (instance_ok ()) + instance->do_set_event_hook (f); +} + +void +command_editor::restore_event_hook (void) +{ + if (instance_ok ()) + instance->do_restore_event_hook (); +} + +void command_editor::read_init_file (const string& file) { if (instance_ok ())