Mercurial > octave
diff liboctave/util/action-container.cc @ 27338:829d9efb7730
allow gui events to interrupt readline event processing (bug #56738)
* liboctave/util/action-container.cc: New file.
* action-container.h, action-container.cc (action_container::run):
Break out of loop if command_editor::input_interrupted is true.
* liboctave/util/module.mk: Update.
* cmd-edit.h (command_editor::input_interrupted,
command_editor::do_input_interrupted): New functions.
* cmd-edit.cc (gnu_readline::do_input_interrupted): New function.
* oct-rl-edit.h, oct-rl-edit.c (octave_rl_input_interrupted):
New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Aug 2019 19:13:46 -0400 |
parents | |
children | 64289bf338da |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/util/action-container.cc Tue Aug 13 19:13:46 2019 -0400 @@ -0,0 +1,46 @@ +/* + +Copyright (C) 1993-2019 John W. Eaton +Copyright (C) 2009-2010 VZLU Prague + +This file is part of Octave. + +Octave is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Octave is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<https://www.gnu.org/licenses/>. + +*/ + +#include "action-container.h" +#include "cmd-edit.h" + +namespace octave +{ + void action_container::run (size_t num) + { + if (num > size ()) + num = size (); + + for (size_t i = 0; i < num; i++) + { + run_first (); + + // If input_interrupted is TRUE, a user callback event has + // requested that we break out of the readline event handler to + // process a command or other action. + + if (command_editor::input_interrupted ()) + break; + } + } +}