Mercurial > octave
annotate liboctave/util/oct-rl-edit.c @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 0a5b15007766 |
children | e4a52cb9ce41 |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
3 // Copyright (C) 2000-2022 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 //////////////////////////////////////////////////////////////////////// |
3519 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
27 # include "config.h" |
3519 | 28 #endif |
29 | |
30 #if defined (USE_READLINE) | |
31 | |
32 #include <stdio.h> | |
33 #include <stdlib.h> | |
34 | |
35 #include <readline/readline.h> | |
36 | |
37 #include "oct-rl-edit.h" | |
38 | |
3933 | 39 #define OCTAVE_RL_SAVE_STRING(ss, s) \ |
40 static char *ss = 0; \ | |
41 \ | |
42 if (ss) \ | |
43 { \ | |
44 free (ss); \ | |
45 ss = 0; \ | |
46 } \ | |
47 \ | |
48 ss = malloc (strlen (s) + 1); \ | |
49 \ | |
26508
97a37df42734
oct-rl-edit.c: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
50 if (ss) \ |
97a37df42734
oct-rl-edit.c: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
51 strcpy (ss, s) |
3933 | 52 |
6979 | 53 void |
54 octave_rl_redisplay (void) | |
55 { | |
56 rl_redisplay (); | |
57 } | |
58 | |
3519 | 59 int |
60 octave_rl_screen_height (void) | |
61 { | |
3779 | 62 int rows, cols; |
63 rl_get_screen_size (&rows, &cols); | |
64 return rows; | |
3519 | 65 } |
66 | |
67 int | |
68 octave_rl_screen_width (void) | |
69 { | |
3779 | 70 int rows, cols; |
71 rl_get_screen_size (&rows, &cols); | |
72 return cols; | |
3519 | 73 } |
74 | |
75 void | |
3779 | 76 octave_rl_enable_paren_matching (int val) |
3519 | 77 { |
3779 | 78 rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); |
3519 | 79 } |
80 | |
19378
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
81 int |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
82 octave_rl_erase_empty_line (int val) |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
83 { |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
84 int retval = rl_erase_empty_line; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
85 rl_erase_empty_line = val; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
86 return retval; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
87 } |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
88 |
3946 | 89 /* It would be much simpler if we could just call _rl_clear_screen to |
90 only clear the screen, but it is not a public function, and on some | |
91 systems, it is not exported from shared library versions of | |
92 readline, so we can't use it. | |
93 | |
94 Instead, temporarily redefine the redisplay function to do nothing. | |
95 | |
21066
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
20919
diff
changeset
|
96 FIXME: It would be safer to do this when protected from interrupts... */ |
3856 | 97 |
98 static void | |
5394 | 99 flush_stdout (void) |
3856 | 100 { |
5394 | 101 fflush (stdout); |
3856 | 102 } |
103 | |
3519 | 104 void |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
105 octave_rl_clear_screen (int skip_redisplay) |
3519 | 106 { |
3855 | 107 int ignore1 = 0; |
108 int ignore2 = 0; | |
109 | |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
110 if (skip_redisplay) |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
111 { |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
112 rl_voidfunc_t *saved_redisplay_function = rl_redisplay_function; |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
113 |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
114 rl_redisplay_function = flush_stdout; |
3855 | 115 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
116 rl_clear_screen (ignore1, ignore2); |
3856 | 117 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
118 rl_redisplay_function = saved_redisplay_function; |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
119 } |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
120 else |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
121 rl_clear_screen (ignore1, ignore2); |
3519 | 122 } |
123 | |
124 void | |
125 octave_rl_resize_terminal (void) | |
126 { | |
127 rl_resize_terminal (); | |
128 } | |
129 | |
130 void | |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
131 octave_rl_set_screen_size (int ht, int wd) |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
132 { |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
133 rl_set_screen_size (ht, wd); |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
134 } |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
135 |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
136 void |
3519 | 137 octave_rl_restore_terminal_state () |
138 { | |
139 if (rl_deprep_term_function) | |
140 rl_deprep_term_function (); | |
141 } | |
142 | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
143 char * |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
144 octave_rl_copy_line (void) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
145 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
146 return rl_copy_text (0, rl_end); |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
147 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
148 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
149 void |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
150 octave_rl_replace_line (const char *s, int clear_undo) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
151 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
152 rl_replace_line (s, clear_undo); |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
153 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
154 |
3519 | 155 void |
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
|
156 octave_rl_kill_full_line (void) |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
157 { |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
158 rl_kill_full_line (0, 0); |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
159 } |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
160 |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
161 void |
3519 | 162 octave_rl_insert_text (const char *s) |
163 { | |
164 rl_insert_text (s); | |
165 } | |
166 | |
6979 | 167 int |
168 octave_rl_newline (int count, int key) | |
3519 | 169 { |
6979 | 170 return rl_newline (count, key); |
171 } | |
172 | |
173 const char * | |
174 octave_rl_line_buffer (void) | |
175 { | |
176 return rl_line_buffer; | |
3519 | 177 } |
178 | |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
179 int |
22171
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
180 octave_rl_point (void) |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
181 { |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
182 return rl_point; |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
183 } |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
184 |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21798
diff
changeset
|
185 int |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
186 octave_rl_do_undo (void) |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
187 { |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
188 return rl_do_undo (); |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
189 } |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
190 |
3519 | 191 void |
192 octave_rl_clear_undo_list (void) | |
193 { | |
194 if (rl_undo_list) | |
195 { | |
3779 | 196 rl_free_undo_list (); |
3519 | 197 |
198 rl_undo_list = 0; | |
199 } | |
200 } | |
201 | |
202 void | |
203 octave_rl_set_name (const char *n) | |
204 { | |
3933 | 205 OCTAVE_RL_SAVE_STRING (nm, n); |
3519 | 206 |
207 rl_readline_name = nm; | |
208 | |
209 /* Since we've already called rl_initialize, we need to re-read the | |
210 init file to take advantage of the conditional parsing feature | |
211 based on rl_readline_name; */ | |
212 | |
3779 | 213 rl_re_read_init_file (0, 0); |
3519 | 214 } |
215 | |
216 char * | |
217 octave_rl_readline (const char *prompt) | |
218 { | |
219 return readline (prompt); | |
220 } | |
221 | |
222 void | |
223 octave_rl_set_input_stream (FILE *f) | |
224 { | |
225 rl_instream = f; | |
226 } | |
227 | |
228 FILE * | |
229 octave_rl_get_input_stream (void) | |
230 { | |
231 return rl_instream; | |
232 } | |
233 | |
234 void | |
235 octave_rl_set_output_stream (FILE *f) | |
236 { | |
237 rl_outstream = f; | |
238 } | |
239 | |
240 FILE * | |
241 octave_rl_get_output_stream (void) | |
242 { | |
243 return rl_outstream; | |
244 } | |
245 | |
246 void | |
247 octave_rl_read_init_file (const char *f) | |
248 { | |
7757
4ff9a6fdde42
Load the default inputrc when calling read_readline_init_file()
Rafael Laboissiere <rafael@debian.org>
parents:
7017
diff
changeset
|
249 rl_read_init_file (f); |
3519 | 250 } |
251 | |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
252 void |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
253 octave_rl_re_read_init_file (void) |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
254 { |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
255 rl_re_read_init_file (0, 0); |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
256 } |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
257 |
4143 | 258 int |
259 octave_rl_filename_completion_desired (int arg) | |
260 { | |
261 int retval = rl_filename_completion_desired; | |
262 rl_filename_completion_desired = arg; | |
263 return retval; | |
264 } | |
265 | |
6979 | 266 int |
267 octave_rl_filename_quoting_desired (int arg) | |
268 { | |
269 int retval = rl_filename_quoting_desired; | |
270 rl_filename_quoting_desired = arg; | |
271 return retval; | |
272 } | |
273 | |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
274 int |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
275 octave_rl_prefer_env_winsize (int arg) |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
276 { |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
277 int retval = rl_prefer_env_winsize; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
278 rl_prefer_env_winsize = arg; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
279 return retval; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
280 } |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
281 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
282 void |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
283 octave_rl_done (int arg) |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
284 { |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
285 rl_done = arg; |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
286 } |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
287 |
4604 | 288 char * |
289 octave_rl_filename_completion_function (const char *text, int state) | |
290 { | |
291 return rl_filename_completion_function (text, state); | |
292 } | |
293 | |
3519 | 294 void |
3933 | 295 octave_rl_set_basic_word_break_characters (const char *s) |
296 { | |
297 OCTAVE_RL_SAVE_STRING (ss, s); | |
298 | |
299 rl_basic_word_break_characters = ss; | |
300 } | |
301 | |
302 void | |
303 octave_rl_set_completer_word_break_characters (const char *s) | |
304 { | |
305 OCTAVE_RL_SAVE_STRING (ss, s); | |
306 | |
307 rl_completer_word_break_characters = ss; | |
308 } | |
309 | |
21798
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
310 char * |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
311 octave_rl_get_completer_word_break_characters (void) |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
312 { |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
313 return rl_completer_word_break_characters; |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
314 } |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
315 |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
316 void |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
317 octave_rl_set_completion_word_break_hook (rl_completion_hook_fcn_ptr f) |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
318 { |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
319 rl_completion_word_break_hook = f; |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
320 } |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21724
diff
changeset
|
321 |
3933 | 322 void |
3519 | 323 octave_rl_set_basic_quote_characters (const char *s) |
324 { | |
3933 | 325 OCTAVE_RL_SAVE_STRING (ss, s); |
3519 | 326 |
327 rl_basic_quote_characters = ss; | |
328 } | |
329 | |
330 void | |
6979 | 331 octave_rl_set_filename_quote_characters (const char *s) |
332 { | |
333 OCTAVE_RL_SAVE_STRING (ss, s); | |
334 | |
335 rl_filename_quote_characters = ss; | |
336 } | |
337 | |
338 void | |
339 octave_rl_set_completer_quote_characters (const char *s) | |
340 { | |
341 OCTAVE_RL_SAVE_STRING (ss, s); | |
342 | |
343 rl_completer_quote_characters = ss; | |
344 } | |
345 | |
346 void | |
3519 | 347 octave_rl_set_completion_append_character (char c) |
348 { | |
349 rl_completion_append_character = c; | |
350 } | |
351 | |
352 void | |
353 octave_rl_set_completion_function (rl_attempted_completion_fcn_ptr f) | |
354 { | |
355 rl_attempted_completion_function = f; | |
356 } | |
357 | |
358 void | |
6979 | 359 octave_rl_set_quoting_function (rl_quoting_fcn_ptr f) |
360 { | |
361 rl_filename_quoting_function = f; | |
362 } | |
363 | |
364 void | |
365 octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr f) | |
366 { | |
367 rl_filename_dequoting_function = f; | |
368 } | |
369 | |
370 void | |
371 octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_ptr f) | |
372 { | |
373 rl_char_is_quoted_p = f; | |
374 } | |
375 | |
376 void | |
3519 | 377 octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr f) |
378 { | |
4802 | 379 rl_startup_hook = f; |
3519 | 380 } |
381 | |
382 rl_startup_hook_fcn_ptr | |
383 octave_rl_get_startup_hook (void) | |
384 { | |
4802 | 385 return rl_startup_hook; |
3519 | 386 } |
387 | |
388 void | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
389 octave_rl_set_pre_input_hook (rl_pre_input_hook_fcn_ptr f) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
390 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
391 rl_pre_input_hook = f; |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
392 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
393 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
394 rl_pre_input_hook_fcn_ptr |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
395 octave_rl_get_pre_input_hook (void) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
396 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
397 return rl_pre_input_hook; |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
398 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
399 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
400 void |
3519 | 401 octave_rl_set_event_hook (rl_event_hook_fcn_ptr f) |
402 { | |
4802 | 403 rl_event_hook = f; |
3519 | 404 } |
405 | |
406 rl_event_hook_fcn_ptr | |
407 octave_rl_get_event_hook (void) | |
408 { | |
4802 | 409 return rl_event_hook; |
3519 | 410 } |
411 | |
412 char ** | |
413 octave_rl_completion_matches (const char *text, rl_completer_fcn_ptr f) | |
414 { | |
3779 | 415 return rl_completion_matches (text, f); |
3519 | 416 } |
417 | |
418 char | |
419 octave_rl_prompt_start_ignore (void) | |
420 { | |
421 return RL_PROMPT_START_IGNORE; | |
422 } | |
423 | |
424 char | |
425 octave_rl_prompt_end_ignore (void) | |
426 { | |
427 return RL_PROMPT_END_IGNORE; | |
428 } | |
429 | |
430 void | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
431 octave_rl_add_defun (const char *name, rl_fcn_ptr f, int key) |
3519 | 432 { |
433 rl_add_defun (name, f, key); | |
434 } | |
435 | |
436 void | |
437 octave_rl_set_terminal_name (const char *term) | |
438 { | |
10102
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
439 OCTAVE_RL_SAVE_STRING (saved_term, term); |
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
440 |
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
441 rl_terminal_name = saved_term; |
3519 | 442 } |
443 | |
444 void | |
445 octave_rl_initialize (void) | |
446 { | |
17958
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
447 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
448 rl_catch_signals = 0; |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
449 #endif |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
450 |
3519 | 451 rl_initialize (); |
452 } | |
453 | |
454 int | |
455 octave_rl_history_search_forward (int count, int ignore) | |
456 { | |
457 return rl_history_search_forward (count, ignore); | |
458 } | |
459 | |
460 int | |
461 octave_rl_history_search_backward (int count, int ignore) | |
462 { | |
463 return rl_history_search_backward (count, ignore); | |
464 } | |
465 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
466 int |
3519 | 467 octave_rl_ctrl (char c) |
468 { | |
469 return CTRL (c); | |
470 } | |
471 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
472 int |
3519 | 473 octave_rl_meta (char c) |
474 { | |
475 return META (c); | |
476 } | |
477 | |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
478 void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
479 octave_rl_recover_from_interrupt (void) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
480 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
481 rl_free_line_state (); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
482 rl_cleanup_after_signal (); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
483 rl_reset_after_signal (); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
484 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
485 |
3519 | 486 #endif |