Mercurial > octave
annotate liboctave/util/oct-rl-edit.c @ 21301:40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
* mk-octave-config-h.sh, mk-opts.pl, Backend.cc, BaseControl.cc,
ButtonControl.cc, Canvas.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc,
EditControl.cc, Figure.cc, FigureWindow.cc, GLCanvas.cc, KeyMap.cc,
ListBoxControl.cc, Logger.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc,
ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc,
PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, RadioButtonControl.cc,
SliderControl.cc, TextControl.cc, TextEdit.cc, ToggleButtonControl.cc,
ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc,
annotation-dialog.cc, gl-select.cc, module.mk, kpty.cpp, color-picker.cc,
dialog.cc, documentation-dock-widget.cc, files-dock-widget.cc,
find-files-dialog.cc, find-files-model.cc, history-dock-widget.cc,
file-editor-tab.cc, file-editor-tab.h, file-editor.cc, find-dialog.cc,
marker.cc, octave-qscintilla.cc, octave-txt-lexer.cc, main-window.cc,
octave-cmd.cc, octave-dock-widget.cc, octave-gui.cc, octave-interpreter.cc,
octave-qt-link.cc, parser.cc, webinfo.cc, resource-manager.cc,
settings-dialog.cc, shortcut-manager.cc, terminal-dock-widget.cc,
thread-manager.cc, welcome-wizard.cc, workspace-model.cc, workspace-view.cc,
build-env-features.sh, build-env.in.cc, Cell.cc, __contourc__.cc,
__dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc,
__pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, bitfcns.cc,
bsxfun.cc, c-file-ptr-stream.cc, cdisplay.c, cellfun.cc, coct-hdf5-types.c,
colloc.cc, comment-list.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
debug.cc, defaults.cc, defun.cc, det.cc, dirfns.cc, display.cc, dlmread.cc,
dot.cc, dynamic-ld.cc, eig.cc, ellipj.cc, error.cc, errwarn.cc, event-queue.cc,
fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc,
gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc,
gl-render.cc, gl2ps-print.cc, graphics.cc, gripes.cc, hash.cc, help.cc,
hess.cc, hex2num.cc, hook-fcn.cc, input.cc, inv.cc, jit-ir.cc, jit-typeinfo.cc,
jit-util.cc, kron.cc, load-path.cc, load-save.cc, lookup.cc,
ls-ascii-helper.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc,
ls-oct-binary.cc, ls-oct-text.cc, ls-utils.cc, lsode.cc, lu.cc, luinc.cc,
mappers.cc, matrix_type.cc, max.cc, mex.cc, mgorth.cc, nproc.cc,
oct-errno.in.cc, oct-fstrm.cc, oct-hdf5-types.cc, oct-hist.cc, oct-iostrm.cc,
oct-lvalue.cc, oct-map.cc, oct-prcstrm.cc, oct-procbuf.cc, oct-stream.cc,
oct-strstrm.cc, oct-tex-lexer.in.ll, oct-tex-parser.in.yy, octave-link.cc,
ordschur.cc, pager.cc, pinv.cc, pr-output.cc, procstream.cc, profiler.cc,
psi.cc, pt-jit.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc,
schur.cc, sighandlers.cc, siglist.c, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc,
spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc,
sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, text-renderer.cc, time.cc,
toplev.cc, tril.cc, tsearch.cc, txt-eng.cc, typecast.cc, urlwrite.cc, utils.cc,
variables.cc, xdiv.cc, xgl2ps.c, xnorm.cc, xpow.cc, zfstream.cc,
__delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc,
__init_fltk__.cc, __init_gnuplot__.cc, __magick_read__.cc, __osmesa_print__.cc,
__voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc,
colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, qr.cc, symbfact.cc, symrcm.cc,
mkbuiltins, mkops, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc,
ov-base-scalar.cc, ov-base-sparse.cc, ov-base.cc, ov-bool-mat.cc,
ov-bool-sparse.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-ch-mat.cc,
ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.cc,
ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-fcn-handle.cc,
ov-fcn-inline.cc, ov-fcn.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc,
ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-lazy-idx.cc,
ov-mex-fcn.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-perm.cc, ov-range.cc,
ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc,
ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc,
ov-uint8.cc, ov-usr-fcn.cc, ov.cc, ovl.cc, octave.cc, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-double-conv.cc, op-fcdm-fcdm.cc,
op-fcdm-fdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc,
op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc,
op-fdm-fdm.cc, op-float-conv.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc,
op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc,
op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc,
op-int-conv.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc,
op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc,
op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc,
op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc,
op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc,
op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc,
op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, lex.ll, oct-parse.in.yy,
pt-arg-list.cc, pt-array-list.cc, pt-assign.cc, pt-binop.cc, pt-bp.cc,
pt-cbinop.cc, pt-cell.cc, pt-check.cc, pt-classdef.cc, pt-cmd.cc, pt-colon.cc,
pt-const.cc, pt-decl.cc, pt-eval.cc, pt-except.cc, pt-exp.cc, pt-fcn-handle.cc,
pt-funcall.cc, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-loop.cc, pt-mat.cc,
pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, pt-unop.cc, pt.cc,
token.cc, Array-jit.cc, Array-os.cc, Array-sym.cc, Array-tc.cc, version.cc,
Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc,
Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc,
Array-voidp.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc,
CNDArray.cc, CRowVector.cc, CSparse.cc, DiagArray2.cc, MArray-C.cc,
MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc,
MDiagArray2.cc, MSparse-C.cc, MSparse-d.cc, MatrixType.cc, PermMatrix.cc,
Range.cc, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, boolMatrix.cc,
boolNDArray.cc, boolSparse.cc, chMatrix.cc, chNDArray.cc, dColVector.cc,
dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc,
dim-vector.cc, fCColVector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc,
fCRowVector.cc, fColVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc,
fRowVector.cc, idx-vector.cc, int16NDArray.cc, int32NDArray.cc,
int64NDArray.cc, int8NDArray.cc, intNDArray.cc, uint16NDArray.cc,
uint32NDArray.cc, uint64NDArray.cc, uint8NDArray.cc, blaswrap.c, cquit.c,
f77-extern.cc, f77-fcn.c, lo-error.c, quit.cc, CollocWt.cc, DASPK.cc, DASRT.cc,
DASSL.cc, EIG.cc, LSODE.cc, ODES.cc, Quad.cc, aepbalance.cc, chol.cc,
eigs-base.cc, fEIG.cc, gepbalance.cc, hess.cc, lo-mappers.cc, lo-specfun.cc,
lu.cc, oct-convn.cc, oct-fftw.cc, oct-norm.cc, oct-rand.cc, oct-spparms.cc,
qr.cc, qrp.cc, randgamma.c, randmtzig.c, randpoisson.c, schur.cc,
sparse-chol.cc, sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, svd.cc,
mk-ops.awk, dir-ops.cc, file-ops.cc, file-stat.cc, lo-sysdep.cc, mach-info.cc,
oct-env.cc, oct-group.cc, oct-passwd.cc, oct-syscalls.cc, oct-time.cc,
oct-uname.cc, cmd-edit.cc, cmd-hist.cc, data-conv.cc, f2c-main.c,
glob-match.cc, kpse.cc, lo-array-errwarn.cc, lo-array-gripes.cc, lo-cutils.c,
lo-ieee.cc, lo-regexp.cc, lo-utils.cc, oct-base64.cc, oct-glob.cc,
oct-inttypes.cc, oct-locbuf.cc, oct-mutex.cc, oct-rl-edit.c, oct-rl-hist.c,
oct-shlib.cc, oct-sort.cc, pathsearch.cc, singleton-cleanup.cc, sparse-sort.cc,
sparse-util.cc, str-vec.cc, unwind-prot.cc, url-transfer.cc,
display-available.c, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc,
octave-config.in.cc:
Use '#include "config.h"' rather than <config.h>.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 18 Feb 2016 13:34:50 -0800 |
parents | f7121e111991 |
children | aba2e6293dd8 |
rev | line source |
---|---|
3519 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19380
diff
changeset
|
3 Copyright (C) 2000-2015 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 | |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
24 # include "config.h" |
3519 | 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 | |
21066
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
20919
diff
changeset
|
92 FIXME: It would be safer to do this when protected from interrupts... */ |
3856 | 93 |
94 static void | |
5394 | 95 flush_stdout (void) |
3856 | 96 { |
5394 | 97 fflush (stdout); |
3856 | 98 } |
99 | |
3519 | 100 void |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
101 octave_rl_clear_screen (int skip_redisplay) |
3519 | 102 { |
3855 | 103 int ignore1 = 0; |
104 int ignore2 = 0; | |
105 | |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
106 if (skip_redisplay) |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
107 { |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
108 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
|
109 |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
110 rl_redisplay_function = flush_stdout; |
3855 | 111 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
112 rl_clear_screen (ignore1, ignore2); |
3856 | 113 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
114 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
|
115 } |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
116 else |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
117 rl_clear_screen (ignore1, ignore2); |
3519 | 118 } |
119 | |
120 void | |
121 octave_rl_resize_terminal (void) | |
122 { | |
123 rl_resize_terminal (); | |
124 } | |
125 | |
126 void | |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
127 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
|
128 { |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
129 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
|
130 } |
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 void |
3519 | 133 octave_rl_restore_terminal_state () |
134 { | |
135 if (rl_deprep_term_function) | |
136 rl_deprep_term_function (); | |
137 } | |
138 | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
139 char * |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
140 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
|
141 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
142 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
|
143 } |
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 void |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
146 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
|
147 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
148 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
|
149 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
150 |
3519 | 151 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
|
152 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
|
153 { |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
154 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
|
155 } |
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 |
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 void |
3519 | 158 octave_rl_insert_text (const char *s) |
159 { | |
160 rl_insert_text (s); | |
161 } | |
162 | |
6979 | 163 int |
164 octave_rl_newline (int count, int key) | |
3519 | 165 { |
6979 | 166 return rl_newline (count, key); |
167 } | |
168 | |
169 const char * | |
170 octave_rl_line_buffer (void) | |
171 { | |
172 return rl_line_buffer; | |
3519 | 173 } |
174 | |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
175 int |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
176 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
|
177 { |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
178 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
|
179 } |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
180 |
3519 | 181 void |
182 octave_rl_clear_undo_list (void) | |
183 { | |
184 if (rl_undo_list) | |
185 { | |
3779 | 186 rl_free_undo_list (); |
3519 | 187 |
188 rl_undo_list = 0; | |
189 } | |
190 } | |
191 | |
192 void | |
193 octave_rl_set_name (const char *n) | |
194 { | |
3933 | 195 OCTAVE_RL_SAVE_STRING (nm, n); |
3519 | 196 |
197 rl_readline_name = nm; | |
198 | |
199 /* Since we've already called rl_initialize, we need to re-read the | |
200 init file to take advantage of the conditional parsing feature | |
201 based on rl_readline_name; */ | |
202 | |
3779 | 203 rl_re_read_init_file (0, 0); |
3519 | 204 } |
205 | |
206 char * | |
207 octave_rl_readline (const char *prompt) | |
208 { | |
209 return readline (prompt); | |
210 } | |
211 | |
212 void | |
213 octave_rl_set_input_stream (FILE *f) | |
214 { | |
215 rl_instream = f; | |
216 } | |
217 | |
218 FILE * | |
219 octave_rl_get_input_stream (void) | |
220 { | |
221 return rl_instream; | |
222 } | |
223 | |
224 void | |
225 octave_rl_set_output_stream (FILE *f) | |
226 { | |
227 rl_outstream = f; | |
228 } | |
229 | |
230 FILE * | |
231 octave_rl_get_output_stream (void) | |
232 { | |
233 return rl_outstream; | |
234 } | |
235 | |
236 void | |
237 octave_rl_read_init_file (const char *f) | |
238 { | |
7757
4ff9a6fdde42
Load the default inputrc when calling read_readline_init_file()
Rafael Laboissiere <rafael@debian.org>
parents:
7017
diff
changeset
|
239 rl_read_init_file (f); |
3519 | 240 } |
241 | |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
242 void |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
243 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
|
244 { |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
245 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
|
246 } |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
247 |
4143 | 248 int |
249 octave_rl_filename_completion_desired (int arg) | |
250 { | |
251 int retval = rl_filename_completion_desired; | |
252 rl_filename_completion_desired = arg; | |
253 return retval; | |
254 } | |
255 | |
6979 | 256 int |
257 octave_rl_filename_quoting_desired (int arg) | |
258 { | |
259 int retval = rl_filename_quoting_desired; | |
260 rl_filename_quoting_desired = arg; | |
261 return retval; | |
262 } | |
263 | |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
264 int |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
265 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
|
266 { |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
267 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
|
268 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
|
269 return retval; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
270 } |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
271 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
272 void |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
273 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
|
274 { |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
275 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
|
276 } |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
277 |
4604 | 278 char * |
279 octave_rl_filename_completion_function (const char *text, int state) | |
280 { | |
281 return rl_filename_completion_function (text, state); | |
282 } | |
283 | |
3519 | 284 void |
3933 | 285 octave_rl_set_basic_word_break_characters (const char *s) |
286 { | |
287 OCTAVE_RL_SAVE_STRING (ss, s); | |
288 | |
289 rl_basic_word_break_characters = ss; | |
290 } | |
291 | |
292 void | |
293 octave_rl_set_completer_word_break_characters (const char *s) | |
294 { | |
295 OCTAVE_RL_SAVE_STRING (ss, s); | |
296 | |
297 rl_completer_word_break_characters = ss; | |
298 } | |
299 | |
300 void | |
3519 | 301 octave_rl_set_basic_quote_characters (const char *s) |
302 { | |
3933 | 303 OCTAVE_RL_SAVE_STRING (ss, s); |
3519 | 304 |
305 rl_basic_quote_characters = ss; | |
306 } | |
307 | |
308 void | |
6979 | 309 octave_rl_set_filename_quote_characters (const char *s) |
310 { | |
311 OCTAVE_RL_SAVE_STRING (ss, s); | |
312 | |
313 rl_filename_quote_characters = ss; | |
314 } | |
315 | |
316 void | |
317 octave_rl_set_completer_quote_characters (const char *s) | |
318 { | |
319 OCTAVE_RL_SAVE_STRING (ss, s); | |
320 | |
321 rl_completer_quote_characters = ss; | |
322 } | |
323 | |
324 void | |
3519 | 325 octave_rl_set_completion_append_character (char c) |
326 { | |
327 rl_completion_append_character = c; | |
328 } | |
329 | |
330 void | |
331 octave_rl_set_completion_function (rl_attempted_completion_fcn_ptr f) | |
332 { | |
333 rl_attempted_completion_function = f; | |
334 } | |
335 | |
336 void | |
6979 | 337 octave_rl_set_quoting_function (rl_quoting_fcn_ptr f) |
338 { | |
339 rl_filename_quoting_function = f; | |
340 } | |
341 | |
342 void | |
343 octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr f) | |
344 { | |
345 rl_filename_dequoting_function = f; | |
346 } | |
347 | |
348 void | |
349 octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_ptr f) | |
350 { | |
351 rl_char_is_quoted_p = f; | |
352 } | |
353 | |
354 void | |
3519 | 355 octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr f) |
356 { | |
4802 | 357 rl_startup_hook = f; |
3519 | 358 } |
359 | |
360 rl_startup_hook_fcn_ptr | |
361 octave_rl_get_startup_hook (void) | |
362 { | |
4802 | 363 return rl_startup_hook; |
3519 | 364 } |
365 | |
366 void | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
367 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
|
368 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
369 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
|
370 } |
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 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
|
373 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
|
374 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
375 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
|
376 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
377 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
378 void |
3519 | 379 octave_rl_set_event_hook (rl_event_hook_fcn_ptr f) |
380 { | |
4802 | 381 rl_event_hook = f; |
3519 | 382 } |
383 | |
384 rl_event_hook_fcn_ptr | |
385 octave_rl_get_event_hook (void) | |
386 { | |
4802 | 387 return rl_event_hook; |
3519 | 388 } |
389 | |
390 char ** | |
391 octave_rl_completion_matches (const char *text, rl_completer_fcn_ptr f) | |
392 { | |
3779 | 393 return rl_completion_matches (text, f); |
3519 | 394 } |
395 | |
396 char | |
397 octave_rl_prompt_start_ignore (void) | |
398 { | |
399 return RL_PROMPT_START_IGNORE; | |
400 } | |
401 | |
402 char | |
403 octave_rl_prompt_end_ignore (void) | |
404 { | |
405 return RL_PROMPT_END_IGNORE; | |
406 } | |
407 | |
408 void | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
409 octave_rl_add_defun (const char *name, rl_fcn_ptr f, int key) |
3519 | 410 { |
411 rl_add_defun (name, f, key); | |
412 } | |
413 | |
414 void | |
415 octave_rl_set_terminal_name (const char *term) | |
416 { | |
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
|
417 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
|
418 |
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
|
419 rl_terminal_name = saved_term; |
3519 | 420 } |
421 | |
422 void | |
423 octave_rl_initialize (void) | |
424 { | |
17958
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
425 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
426 rl_catch_signals = 0; |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
427 #endif |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
428 |
3519 | 429 rl_initialize (); |
430 } | |
431 | |
432 int | |
433 octave_rl_history_search_forward (int count, int ignore) | |
434 { | |
435 return rl_history_search_forward (count, ignore); | |
436 } | |
437 | |
438 int | |
439 octave_rl_history_search_backward (int count, int ignore) | |
440 { | |
441 return rl_history_search_backward (count, ignore); | |
442 } | |
443 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
444 int |
3519 | 445 octave_rl_ctrl (char c) |
446 { | |
447 return CTRL (c); | |
448 } | |
449 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
450 int |
3519 | 451 octave_rl_meta (char c) |
452 { | |
453 return META (c); | |
454 } | |
455 | |
456 #endif |