comparison liboctave/util/cmd-edit.cc @ 16382:389b09a914e2

allow gui to force readline to return from its idle/read loop * cmd-edit.h, cmd-edit.cc (command_editor::interrupt, command_editor::do_interrupt): New functions. (gnu_readline::do_interrupt): New function. * oct-rl-edit.h, oct-rl-edit.c (octave_rl_done): New function. * main-window.cc (main_window::debug_step_into_callback, main_window::debug_step_over_callback, main_window::debug_step_out_callback): Call command_editor::interrupt. * input.cc (get_debug_input): Reset command_editor::interrutp state. If previous state is true, then exit early.
author John W. Eaton <jwe@octave.org>
date Wed, 27 Mar 2013 20:29:06 -0400
parents 049e8bbff782
children 0696dcc92fc8
comparison
equal deleted inserted replaced
16381:f33dcbd6a005 16382:389b09a914e2
161 161
162 bool do_filename_completion_desired (bool); 162 bool do_filename_completion_desired (bool);
163 163
164 bool do_filename_quoting_desired (bool); 164 bool do_filename_quoting_desired (bool);
165 165
166 void do_interrupt (bool);
167
166 static int operate_and_get_next (int, int); 168 static int operate_and_get_next (int, int);
167 169
168 static int history_search_backward (int, int); 170 static int history_search_backward (int, int);
169 171
170 static int history_search_forward (int, int); 172 static int history_search_forward (int, int);
585 gnu_readline::do_filename_quoting_desired (bool arg) 587 gnu_readline::do_filename_quoting_desired (bool arg)
586 { 588 {
587 return ::octave_rl_filename_quoting_desired (arg); 589 return ::octave_rl_filename_quoting_desired (arg);
588 } 590 }
589 591
592 void
593 gnu_readline::do_interrupt (bool arg)
594 {
595 ::octave_rl_done (arg);
596 }
597
590 int 598 int
591 gnu_readline::operate_and_get_next (int /* count */, int /* c */) 599 gnu_readline::operate_and_get_next (int /* count */, int /* c */)
592 { 600 {
593 // Accept the current line. 601 // Accept the current line.
594 602
1266 bool 1274 bool
1267 command_editor::filename_quoting_desired (bool arg) 1275 command_editor::filename_quoting_desired (bool arg)
1268 { 1276 {
1269 return (instance_ok ()) 1277 return (instance_ok ())
1270 ? instance->do_filename_quoting_desired (arg) : false; 1278 ? instance->do_filename_quoting_desired (arg) : false;
1279 }
1280
1281 bool
1282 command_editor::interrupt (bool arg)
1283 {
1284 bool retval;
1285
1286 if (instance_ok ())
1287 {
1288 // Return the current interrupt state.
1289 retval = instance->interrupted;
1290
1291 instance->do_interrupt (arg);
1292
1293 instance->interrupted = arg;
1294 }
1295 else
1296 retval = false;
1297
1298 return retval;
1271 } 1299 }
1272 1300
1273 // Return a string which will be printed as a prompt. The string may 1301 // Return a string which will be printed as a prompt. The string may
1274 // contain special characters which are decoded as follows: 1302 // contain special characters which are decoded as follows:
1275 // 1303 //