Mercurial > octave
annotate liboctave/util/oct-rl-edit.c @ 19378:f7ccd02bc060 gui-release
provide access to the readline variable rl_erase_empty_line
* cmd-edit.h, cmd-edit.cc (command_editor::erase_empty_line,
command_editor::do_erase_empty_line,
gnu_readline::do_erase_empty_line): New functions.
* oct-rl-edit.h, oct-rl-edit.c (octave_rl_erase_empty_line):
New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 04 Dec 2014 15:56:49 -0500 |
parents | 735bc47d18af |
children | 5db5619fe54e |
rev | line source |
---|---|
3519 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
16570
diff
changeset
|
3 Copyright (C) 2000-2013 John W. Eaton |
3519 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3519 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3519 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #if defined (USE_READLINE) | |
28 | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 | |
32 #include <readline/readline.h> | |
33 | |
34 #include "oct-rl-edit.h" | |
35 | |
3933 | 36 #define OCTAVE_RL_SAVE_STRING(ss, s) \ |
37 static char *ss = 0; \ | |
38 \ | |
39 if (ss) \ | |
40 { \ | |
41 free (ss); \ | |
42 ss = 0; \ | |
43 } \ | |
44 \ | |
45 ss = malloc (strlen (s) + 1); \ | |
46 \ | |
47 strcpy (ss, s) | |
48 | |
6979 | 49 void |
50 octave_rl_redisplay (void) | |
51 { | |
52 rl_redisplay (); | |
53 } | |
54 | |
3519 | 55 int |
56 octave_rl_screen_height (void) | |
57 { | |
3779 | 58 int rows, cols; |
59 rl_get_screen_size (&rows, &cols); | |
60 return rows; | |
3519 | 61 } |
62 | |
63 int | |
64 octave_rl_screen_width (void) | |
65 { | |
3779 | 66 int rows, cols; |
67 rl_get_screen_size (&rows, &cols); | |
68 return cols; | |
3519 | 69 } |
70 | |
71 void | |
3779 | 72 octave_rl_enable_paren_matching (int val) |
3519 | 73 { |
3779 | 74 rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); |
3519 | 75 } |
76 | |
19378
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
77 int |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
78 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
|
79 { |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
80 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
|
81 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
|
82 return retval; |
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 |
3946 | 85 /* It would be much simpler if we could just call _rl_clear_screen to |
86 only clear the screen, but it is not a public function, and on some | |
87 systems, it is not exported from shared library versions of | |
88 readline, so we can't use it. | |
89 | |
90 Instead, temporarily redefine the redisplay function to do nothing. | |
91 | |
5775 | 92 FIXME -- It would be safer to do this when protected from |
3946 | 93 interrupts... */ |
3856 | 94 |
95 static void | |
5394 | 96 flush_stdout (void) |
3856 | 97 { |
5394 | 98 fflush (stdout); |
3856 | 99 } |
100 | |
3519 | 101 void |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
102 octave_rl_clear_screen (int skip_redisplay) |
3519 | 103 { |
3855 | 104 int ignore1 = 0; |
105 int ignore2 = 0; | |
106 | |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
107 if (skip_redisplay) |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
108 { |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
109 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
|
110 |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
111 rl_redisplay_function = flush_stdout; |
3855 | 112 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
113 rl_clear_screen (ignore1, ignore2); |
3856 | 114 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
115 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
|
116 } |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
117 else |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
118 rl_clear_screen (ignore1, ignore2); |
3519 | 119 } |
120 | |
121 void | |
122 octave_rl_resize_terminal (void) | |
123 { | |
124 rl_resize_terminal (); | |
125 } | |
126 | |
127 void | |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
128 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
|
129 { |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
130 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
|
131 } |
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 void |
3519 | 134 octave_rl_restore_terminal_state () |
135 { | |
136 if (rl_deprep_term_function) | |
137 rl_deprep_term_function (); | |
138 } | |
139 | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
140 char * |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
141 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
|
142 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
143 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
|
144 } |
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 void |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
147 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
|
148 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
149 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
|
150 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
151 |
3519 | 152 void |
153 octave_rl_insert_text (const char *s) | |
154 { | |
155 rl_insert_text (s); | |
156 } | |
157 | |
6979 | 158 int |
159 octave_rl_newline (int count, int key) | |
3519 | 160 { |
6979 | 161 return rl_newline (count, key); |
162 } | |
163 | |
164 const char * | |
165 octave_rl_line_buffer (void) | |
166 { | |
167 return rl_line_buffer; | |
3519 | 168 } |
169 | |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
170 int |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
171 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
|
172 { |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
173 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
|
174 } |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
175 |
3519 | 176 void |
177 octave_rl_clear_undo_list (void) | |
178 { | |
179 if (rl_undo_list) | |
180 { | |
3779 | 181 rl_free_undo_list (); |
3519 | 182 |
183 rl_undo_list = 0; | |
184 } | |
185 } | |
186 | |
187 void | |
188 octave_rl_set_name (const char *n) | |
189 { | |
3933 | 190 OCTAVE_RL_SAVE_STRING (nm, n); |
3519 | 191 |
192 rl_readline_name = nm; | |
193 | |
194 /* Since we've already called rl_initialize, we need to re-read the | |
195 init file to take advantage of the conditional parsing feature | |
196 based on rl_readline_name; */ | |
197 | |
3779 | 198 rl_re_read_init_file (0, 0); |
3519 | 199 } |
200 | |
201 char * | |
202 octave_rl_readline (const char *prompt) | |
203 { | |
204 return readline (prompt); | |
205 } | |
206 | |
207 void | |
208 octave_rl_set_input_stream (FILE *f) | |
209 { | |
210 rl_instream = f; | |
211 } | |
212 | |
213 FILE * | |
214 octave_rl_get_input_stream (void) | |
215 { | |
216 return rl_instream; | |
217 } | |
218 | |
219 void | |
220 octave_rl_set_output_stream (FILE *f) | |
221 { | |
222 rl_outstream = f; | |
223 } | |
224 | |
225 FILE * | |
226 octave_rl_get_output_stream (void) | |
227 { | |
228 return rl_outstream; | |
229 } | |
230 | |
231 void | |
232 octave_rl_read_init_file (const char *f) | |
233 { | |
7757
4ff9a6fdde42
Load the default inputrc when calling read_readline_init_file()
Rafael Laboissiere <rafael@debian.org>
parents:
7017
diff
changeset
|
234 rl_read_init_file (f); |
3519 | 235 } |
236 | |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
237 void |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
238 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
|
239 { |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
240 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
|
241 } |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
242 |
4143 | 243 int |
244 octave_rl_filename_completion_desired (int arg) | |
245 { | |
246 int retval = rl_filename_completion_desired; | |
247 rl_filename_completion_desired = arg; | |
248 return retval; | |
249 } | |
250 | |
6979 | 251 int |
252 octave_rl_filename_quoting_desired (int arg) | |
253 { | |
254 int retval = rl_filename_quoting_desired; | |
255 rl_filename_quoting_desired = arg; | |
256 return retval; | |
257 } | |
258 | |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
259 int |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
260 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
|
261 { |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
262 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
|
263 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
|
264 return retval; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
265 } |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
266 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
267 void |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
268 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
|
269 { |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
270 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
|
271 } |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
272 |
4604 | 273 char * |
274 octave_rl_filename_completion_function (const char *text, int state) | |
275 { | |
276 return rl_filename_completion_function (text, state); | |
277 } | |
278 | |
3519 | 279 void |
3933 | 280 octave_rl_set_basic_word_break_characters (const char *s) |
281 { | |
282 OCTAVE_RL_SAVE_STRING (ss, s); | |
283 | |
284 rl_basic_word_break_characters = ss; | |
285 } | |
286 | |
287 void | |
288 octave_rl_set_completer_word_break_characters (const char *s) | |
289 { | |
290 OCTAVE_RL_SAVE_STRING (ss, s); | |
291 | |
292 rl_completer_word_break_characters = ss; | |
293 } | |
294 | |
295 void | |
3519 | 296 octave_rl_set_basic_quote_characters (const char *s) |
297 { | |
3933 | 298 OCTAVE_RL_SAVE_STRING (ss, s); |
3519 | 299 |
300 rl_basic_quote_characters = ss; | |
301 } | |
302 | |
303 void | |
6979 | 304 octave_rl_set_filename_quote_characters (const char *s) |
305 { | |
306 OCTAVE_RL_SAVE_STRING (ss, s); | |
307 | |
308 rl_filename_quote_characters = ss; | |
309 } | |
310 | |
311 void | |
312 octave_rl_set_completer_quote_characters (const char *s) | |
313 { | |
314 OCTAVE_RL_SAVE_STRING (ss, s); | |
315 | |
316 rl_completer_quote_characters = ss; | |
317 } | |
318 | |
319 void | |
3519 | 320 octave_rl_set_completion_append_character (char c) |
321 { | |
322 rl_completion_append_character = c; | |
323 } | |
324 | |
325 void | |
326 octave_rl_set_completion_function (rl_attempted_completion_fcn_ptr f) | |
327 { | |
328 rl_attempted_completion_function = f; | |
329 } | |
330 | |
331 void | |
6979 | 332 octave_rl_set_quoting_function (rl_quoting_fcn_ptr f) |
333 { | |
334 rl_filename_quoting_function = f; | |
335 } | |
336 | |
337 void | |
338 octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr f) | |
339 { | |
340 rl_filename_dequoting_function = f; | |
341 } | |
342 | |
343 void | |
344 octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_ptr f) | |
345 { | |
346 rl_char_is_quoted_p = f; | |
347 } | |
348 | |
349 void | |
3519 | 350 octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr f) |
351 { | |
4802 | 352 rl_startup_hook = f; |
3519 | 353 } |
354 | |
355 rl_startup_hook_fcn_ptr | |
356 octave_rl_get_startup_hook (void) | |
357 { | |
4802 | 358 return rl_startup_hook; |
3519 | 359 } |
360 | |
361 void | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
362 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
|
363 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
364 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
|
365 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
366 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
367 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
|
368 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
|
369 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
370 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
|
371 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
372 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
373 void |
3519 | 374 octave_rl_set_event_hook (rl_event_hook_fcn_ptr f) |
375 { | |
4802 | 376 rl_event_hook = f; |
3519 | 377 } |
378 | |
379 rl_event_hook_fcn_ptr | |
380 octave_rl_get_event_hook (void) | |
381 { | |
4802 | 382 return rl_event_hook; |
3519 | 383 } |
384 | |
385 char ** | |
386 octave_rl_completion_matches (const char *text, rl_completer_fcn_ptr f) | |
387 { | |
3779 | 388 return rl_completion_matches (text, f); |
3519 | 389 } |
390 | |
391 char | |
392 octave_rl_prompt_start_ignore (void) | |
393 { | |
394 return RL_PROMPT_START_IGNORE; | |
395 } | |
396 | |
397 char | |
398 octave_rl_prompt_end_ignore (void) | |
399 { | |
400 return RL_PROMPT_END_IGNORE; | |
401 } | |
402 | |
403 void | |
404 octave_rl_add_defun (const char *name, rl_fcn_ptr f, char key) | |
405 { | |
406 rl_add_defun (name, f, key); | |
407 } | |
408 | |
409 void | |
410 octave_rl_set_terminal_name (const char *term) | |
411 { | |
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
|
412 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
|
413 |
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
|
414 rl_terminal_name = saved_term; |
3519 | 415 } |
416 | |
417 void | |
418 octave_rl_initialize (void) | |
419 { | |
17958
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
420 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
421 rl_catch_signals = 0; |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
422 #endif |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
423 |
3519 | 424 rl_initialize (); |
425 } | |
426 | |
427 int | |
428 octave_rl_history_search_forward (int count, int ignore) | |
429 { | |
430 return rl_history_search_forward (count, ignore); | |
431 } | |
432 | |
433 int | |
434 octave_rl_history_search_backward (int count, int ignore) | |
435 { | |
436 return rl_history_search_backward (count, ignore); | |
437 } | |
438 | |
439 char | |
440 octave_rl_ctrl (char c) | |
441 { | |
442 return CTRL (c); | |
443 } | |
444 | |
445 char | |
446 octave_rl_meta (char c) | |
447 { | |
448 return META (c); | |
449 } | |
450 | |
451 #endif |