comparison 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
comparison
equal deleted inserted replaced
3214:8cc04ca5b4ca 3215:bc3fdfe311a3
112 112
113 void do_set_startup_hook (fcn f); 113 void do_set_startup_hook (fcn f);
114 114
115 void do_restore_startup_hook (void); 115 void do_restore_startup_hook (void);
116 116
117 void do_set_event_hook (fcn f);
118
119 void do_restore_event_hook (void);
120
117 void do_read_init_file (const string& file); 121 void do_read_init_file (const string& file);
118 122
119 static void operate_and_get_next (int, int); 123 static void operate_and_get_next (int, int);
120 124
121 private: 125 private:
122 126
123 fcn previous_startup_hook; 127 fcn previous_startup_hook;
128
129 fcn previous_event_hook;
124 130
125 completion_fcn completion_function; 131 completion_fcn completion_function;
126 132
127 static char *command_generator (const char *text, int state); 133 static char *command_generator (const char *text, int state);
128 134
129 static char **command_completer (char *text, int start, int end); 135 static char **command_completer (char *text, int start, int end);
130 }; 136 };
131 137
132 gnu_readline::gnu_readline () 138 gnu_readline::gnu_readline ()
133 : command_editor (), previous_startup_hook (0), completion_function (0) 139 : command_editor (), previous_startup_hook (0),
140 previous_event_hook (0), completion_function (0)
134 { 141 {
135 rl_initialize (); 142 rl_initialize ();
136 143
137 do_blink_matching_paren (true); 144 do_blink_matching_paren (true);
138 145
321 328
322 void 329 void
323 gnu_readline::do_restore_startup_hook (void) 330 gnu_readline::do_restore_startup_hook (void)
324 { 331 {
325 rl_startup_hook = previous_startup_hook; 332 rl_startup_hook = previous_startup_hook;
333 }
334
335 void
336 gnu_readline::do_set_event_hook (fcn f)
337 {
338 previous_event_hook = rl_event_hook;
339
340 rl_event_hook = f;
341 }
342
343 void
344 gnu_readline::do_restore_event_hook (void)
345 {
346 rl_event_hook = previous_event_hook;
326 } 347 }
327 348
328 void 349 void
329 gnu_readline::do_read_init_file (const string& file) 350 gnu_readline::do_read_init_file (const string& file)
330 { 351 {
657 void 678 void
658 command_editor::restore_startup_hook (void) 679 command_editor::restore_startup_hook (void)
659 { 680 {
660 if (instance_ok ()) 681 if (instance_ok ())
661 instance->do_restore_startup_hook (); 682 instance->do_restore_startup_hook ();
683 }
684
685 void
686 command_editor::set_event_hook (fcn f)
687 {
688 if (instance_ok ())
689 instance->do_set_event_hook (f);
690 }
691
692 void
693 command_editor::restore_event_hook (void)
694 {
695 if (instance_ok ())
696 instance->do_restore_event_hook ();
662 } 697 }
663 698
664 void 699 void
665 command_editor::read_init_file (const string& file) 700 command_editor::read_init_file (const string& file)
666 { 701 {