annotate liboctave/util/cmd-edit.h @ 33634:4a70f390c85e default tip @

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 28 May 2024 15:25:54 +0200
parents 4b601ca024d5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31845
diff changeset
3 // Copyright (C) 1996-2024 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19702
diff changeset
26 #if ! defined (octave_cmd_edit_h)
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
27 #define octave_cmd_edit_h 1
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
30
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
31 #include <cstdio>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
32
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 6108
diff changeset
33 #include <set>
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
34 #include <string>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
35
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4143
diff changeset
36 #include "str-vec.h"
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4143
diff changeset
37
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
38 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
39
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31845
diff changeset
40 class OCTAVE_API command_editor
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
41 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
42 protected:
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
43
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
44 command_editor ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
45 : m_command_number (1), m_rows (24), m_cols (80), m_interrupted (false),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
46 m_interrupt_event_loop (false), m_initial_input ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
47 { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
48
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
49 public:
3519
957d7d6ab0e0 [project @ 2000-02-02 06:00:09 by jwe]
jwe
parents: 3504
diff changeset
50
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
51 typedef int (*startup_hook_fcn) ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
52
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
53 typedef int (*pre_input_hook_fcn) ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
54
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
55 typedef int (*event_hook_fcn) ();
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
56
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
57 typedef std::string (*completion_fcn) (const std::string&, int);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
58
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
59 typedef char *(*completion_hook_fcn) ();
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21752
diff changeset
60
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
61 typedef std::string (*quoting_fcn) (const std::string&, int, char);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
62
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
63 typedef std::string (*dequoting_fcn) (const std::string&, int);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
64
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65 typedef int (*char_is_quoted_fcn) (const std::string&, int);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
66
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
67 typedef void (*user_accept_line_fcn) (const std::string&);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
68
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
69 OCTAVE_DISABLE_COPY_MOVE (command_editor)
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
70
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
71 virtual ~command_editor () = default;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
72
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
73 static void set_name (const std::string& n);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
74
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
75 static std::string readline (const std::string& prompt);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
76
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
77 static std::string readline (const std::string& prompt, bool& eof);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3215
diff changeset
78
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 static void set_input_stream (FILE *f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
80
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
81 static FILE * get_input_stream ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
82
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
83 static void set_output_stream (FILE *f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
84
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
85 static FILE * get_output_stream ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
86
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
87 static void redisplay ();
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
88
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
89 static int terminal_rows ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
90
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
91 static int terminal_cols ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
92
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
93 static void clear_screen (bool skip_redisplay = false);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
94
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
95 static void resize_terminal ();
3281
aaaa20d31a5f [project @ 1999-10-13 07:02:46 by jwe]
jwe
parents: 3219
diff changeset
96
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97 static void set_screen_size (int ht, int wd);
19309
735bc47d18af command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents: 19304
diff changeset
98
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 static std::string decode_prompt_string (const std::string& s);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
100
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
101 static void restore_terminal_state ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
102
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
103 static void blink_matching_paren (bool flag);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
104
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
105 static bool erase_empty_line (bool flag);
19378
f7ccd02bc060 provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents: 19309
diff changeset
106
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
107 static void set_basic_word_break_characters (const std::string& s);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3519
diff changeset
108
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
109 static void set_completer_word_break_characters (const std::string& s);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3519
diff changeset
110
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
111 static void set_basic_quote_characters (const std::string& s);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
112
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
113 static void set_filename_quote_characters (const std::string& s);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
114
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
115 static void set_completer_quote_characters (const std::string& s);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
116
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
117 static void set_completion_append_character (char c);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
118
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
119 static void set_completion_function (completion_fcn f);
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
120
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
121 static void set_quoting_function (quoting_fcn f);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
122
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
123 static void set_dequoting_function (dequoting_fcn f);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
124
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
125 static void set_char_is_quoted_function (char_is_quoted_fcn f);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
126
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
127 static void set_user_accept_line_function (user_accept_line_fcn f);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
128
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
129 static completion_fcn get_completion_function ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
130
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
131 static quoting_fcn get_quoting_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
132
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
133 static dequoting_fcn get_dequoting_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
134
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
135 static char_is_quoted_fcn get_char_is_quoted_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
136
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
137 static user_accept_line_fcn get_user_accept_line_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
138
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
139 static string_vector
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
140 generate_filename_completions (const std::string& text);
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4143
diff changeset
141
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
142 static std::string get_line_buffer ();
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
143
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
144 static std::string get_current_line ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
145
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
146 static char get_prev_char (int);
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21862
diff changeset
147
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
148 static void replace_line (const std::string& text, bool clear_undo = true);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
149
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
150 static void kill_full_line ();
19702
c048358da712 also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
151
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
152 static void insert_text (const std::string& text);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
153
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
154 static void newline ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
155
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
156 static void accept_line ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
157
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
158 static bool undo ();
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
159
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
160 static void clear_undo_list ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
161
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
162 static void add_startup_hook (startup_hook_fcn f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
163
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
164 static void remove_startup_hook (startup_hook_fcn f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
165
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
166 static void add_pre_input_hook (pre_input_hook_fcn f);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
167
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
168 static void remove_pre_input_hook (pre_input_hook_fcn f);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
169
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
170 static void add_event_hook (event_hook_fcn f);
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
171
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
172 static void remove_event_hook (event_hook_fcn f);
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
173
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
174 static void run_event_hooks ();
13924
3b654a0753b1 Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 11586
diff changeset
175
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
176 static void read_init_file (const std::string& file = "");
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3004
diff changeset
177
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
178 static void re_read_init_file ();
7758
8e14a01ffe9f input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
179
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
180 static bool filename_completion_desired (bool);
4143
62afb31c1f85 [project @ 2002-11-01 17:27:38 by jwe]
jwe
parents: 4055
diff changeset
181
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
182 static bool filename_quoting_desired (bool);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
183
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
184 static bool prefer_env_winsize (bool);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
185
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
186 static bool interrupt (bool = true);
19304
ad93e9be78ee command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents: 17769
diff changeset
187
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
188 static void interrupt_event_loop (bool flag = true);
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
189
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
190 static bool event_loop_interrupted ();
27338
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27158
diff changeset
191
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
192 static int current_command_number ();
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15271
diff changeset
193
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
194 static void reset_current_command_number (int n);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
195
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
196 static void increment_current_command_number ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
197
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
198 static void force_default_editor ();
2967
467aae13b70a [project @ 1997-05-15 16:47:12 by jwe]
jwe
parents: 2941
diff changeset
199
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
200 static void set_initial_input (const std::string& text);
9321
9b87aeb24ea9 avoid using readline at all when line editing suppressed or interpreter embedded
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
201
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
202 static int insert_initial_input ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
203
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
204 private:
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
205
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
206 static bool instance_ok ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
207
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
208 static void make_command_editor ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
209
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
210 static int startup_handler ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
211
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
212 static int pre_input_handler ();
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 6108
diff changeset
213
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
214 static int event_handler ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
215
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
216 static void cleanup_instance ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
217 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
218 delete s_instance;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
219 s_instance = nullptr;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
220 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 6108
diff changeset
221
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
222 static void handle_interrupt_signal ();
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
223
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
224 //--------
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29358
diff changeset
225
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
226 static command_editor *s_instance; // the real thing.
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29358
diff changeset
227
31845
2da025d5e98d maint: Use 's_' prefix for static private class variables.
Rik <rik@octave.org>
parents: 31837
diff changeset
228 static std::set<startup_hook_fcn> s_startup_hook_set;
2da025d5e98d maint: Use 's_' prefix for static private class variables.
Rik <rik@octave.org>
parents: 31837
diff changeset
229 static std::set<pre_input_hook_fcn> s_pre_input_hook_set;
2da025d5e98d maint: Use 's_' prefix for static private class variables.
Rik <rik@octave.org>
parents: 31837
diff changeset
230 static std::set<event_hook_fcn> s_event_hook_set;
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29358
diff changeset
231
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
232 protected:
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
233
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
234 // To use something other than the GNU readline library, derive a new
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
235 // class from command_editor, overload these functions as
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
236 // necessary, and make instance point to the new class.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
237
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
238 virtual void do_set_name (const std::string&) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
239
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
240 std::string do_readline (const std::string& prompt)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
241 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
242 bool eof;
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3215
diff changeset
243
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
244 return do_readline (prompt, eof);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
245 }
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
246
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
247 virtual std::string do_readline (const std::string&, bool&) = 0;
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3215
diff changeset
248
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
249 virtual void do_set_input_stream (FILE *) = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
250
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
251 virtual FILE * do_get_input_stream () = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
252
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
253 virtual void do_set_output_stream (FILE *) = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
254
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
255 virtual FILE * do_get_output_stream () = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
256
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
257 virtual void do_redisplay () { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
258
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
259 virtual int do_terminal_rows () { return m_rows; }
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
260
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
261 virtual int do_terminal_cols () { return m_cols; }
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
262
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
263 virtual void do_clear_screen (bool) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
264
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
265 virtual void do_resize_terminal () { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
266
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
267 virtual void do_set_screen_size (int ht, int wd)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
268 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
269 m_rows = ht;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
270 m_cols = wd;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
271 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
272
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
273 virtual std::string do_decode_prompt_string (const std::string&);
3281
aaaa20d31a5f [project @ 1999-10-13 07:02:46 by jwe]
jwe
parents: 3219
diff changeset
274
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
275 virtual std::string newline_chars () { return "\n"; }
19309
735bc47d18af command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents: 19304
diff changeset
276
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
277 virtual void do_restore_terminal_state () { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
278
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
279 virtual void do_blink_matching_paren (bool) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
280
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
281 virtual bool do_erase_empty_line (bool) { return false; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
282
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
283 virtual void do_set_basic_word_break_characters (const std::string&) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
284
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
285 virtual void do_set_completer_word_break_characters (const std::string&) { }
19378
f7ccd02bc060 provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents: 19309
diff changeset
286
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
287 virtual void do_set_completer_word_break_hook (completion_hook_fcn) { }
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21752
diff changeset
288
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
289 virtual void do_set_basic_quote_characters (const std::string&) { }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3519
diff changeset
290
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
291 virtual void do_set_filename_quote_characters (const std::string&) { }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3519
diff changeset
292
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
293 virtual void do_set_completer_quote_characters (const std::string&) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
294
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
295 virtual void do_set_completion_append_character (char) { }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
296
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
297 virtual void do_set_completion_function (completion_fcn) { }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
298
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
299 virtual void do_set_quoting_function (quoting_fcn) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
300
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
301 virtual void do_set_dequoting_function (dequoting_fcn) { }
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
302
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
303 virtual void do_set_char_is_quoted_function (char_is_quoted_fcn) { }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
304
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
305 virtual void do_set_user_accept_line_function (user_accept_line_fcn) { }
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
306
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
307 virtual completion_fcn do_get_completion_function () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
308 { return nullptr; }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
309
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
310 virtual quoting_fcn do_get_quoting_function () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
311 { return nullptr; }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
312
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
313 virtual dequoting_fcn do_get_dequoting_function () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
314 { return nullptr; }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
315
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
316 virtual char_is_quoted_fcn do_get_char_is_quoted_function () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
317 { return nullptr; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
318
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
319 virtual user_accept_line_fcn do_get_user_accept_line_function () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
320 { return nullptr; }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
321
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
322 virtual string_vector
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
323 do_generate_filename_completions (const std::string& text) = 0;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
324
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
325 virtual std::string do_get_line_buffer () const = 0;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
326
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
327 virtual std::string do_get_current_line () const = 0;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
328
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
329 virtual char do_get_prev_char (int) const = 0;
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21862
diff changeset
330
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
331 virtual void
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
332 do_replace_line (const std::string& text, bool clear_undo) = 0;
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4143
diff changeset
333
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
334 virtual void do_kill_full_line () = 0;
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
335
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
336 virtual void do_insert_text (const std::string& text) = 0;
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
337
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
338 virtual void do_newline () = 0;
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
339
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
340 virtual void do_accept_line () = 0;
19702
c048358da712 also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
341
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
342 virtual bool do_undo () { return false; }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
343
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
344 virtual void do_clear_undo_list () { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
345
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
346 virtual void set_startup_hook (startup_hook_fcn) { }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
347
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
348 virtual void restore_startup_hook () { }
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
349
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
350 virtual void set_pre_input_hook (pre_input_hook_fcn) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
351
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
352 virtual void restore_pre_input_hook () { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
353
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
354 virtual void set_event_hook (event_hook_fcn) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
355
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
356 virtual void restore_event_hook () { }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
357
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
358 virtual void do_read_init_file (const std::string&) { }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
359
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
360 virtual void do_re_read_init_file () { }
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
361
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
362 virtual bool do_filename_completion_desired (bool) { return false; }
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
363
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
364 virtual bool do_filename_quoting_desired (bool) { return false; }
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3004
diff changeset
365
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
366 virtual bool do_prefer_env_winsize (bool) { return false; }
7758
8e14a01ffe9f input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
367
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
368 virtual void do_interrupt (bool) { }
4143
62afb31c1f85 [project @ 2002-11-01 17:27:38 by jwe]
jwe
parents: 4055
diff changeset
369
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
370 virtual void do_handle_interrupt_signal () { }
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
371
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
372 void do_interrupt_event_loop (bool arg) { m_interrupt_event_loop = arg; }
27338
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27158
diff changeset
373
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
374 bool do_event_loop_interrupted () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
375 { return m_interrupt_event_loop; }
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
376
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
377 int do_insert_initial_input ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6913
diff changeset
378
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
379 int read_octal (const std::string& s);
19304
ad93e9be78ee command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents: 17769
diff changeset
380
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
381 void error (int);
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15271
diff changeset
382
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
383 void error (const std::string&);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
384
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
385 // The current command number.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
386 int m_command_number;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
387
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
388 int m_rows;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
389 int m_cols;
27158
af1015a3d558 allow terminal rows and columns to be set when not using readline
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
390
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
391 bool m_interrupted;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
392
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
393 bool m_interrupt_event_loop;
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
394
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
395 std::string m_initial_input;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
396 };
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
397
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
398 OCTAVE_END_NAMESPACE(octave)
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15271
diff changeset
399
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
400 #endif