annotate liboctave/util/cmd-edit.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, 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-fcdm-fcdm.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-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-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.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, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents 1bbcaa97b2dd
children aac27ad79be6
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30157
diff changeset
3 // Copyright (C) 1996-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 ////////////////////////////////////////////////////////////////////////
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
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"
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
28 #endif
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
29
10463
bbe99b2a5ba7 undo recent gnulib-related changes
John W. Eaton <jwe@octave.org>
parents: 10447
diff changeset
30 #include <cstdlib>
bbe99b2a5ba7 undo recent gnulib-related changes
John W. Eaton <jwe@octave.org>
parents: 10447
diff changeset
31 #include <cstring>
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
32
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
33 #include <string>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
34
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
35 #include "cmd-edit.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
36 #include "cmd-hist.h"
5872
44f24cf66b95 [project @ 2006-06-30 18:19:20 by jwe]
jwe
parents: 5775
diff changeset
37 #include "file-ops.h"
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
38 #include "file-stat.h"
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
39 #include "lo-error.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
40 #include "lo-utils.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
41 #include "oct-env.h"
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7758
diff changeset
42 #include "oct-mutex.h"
3260
cd454a6fa1a4 [project @ 1999-08-02 21:55:15 by jwe]
jwe
parents: 3225
diff changeset
43 #include "oct-time.h"
21910
4d723ba06b4a provide wrappers for some unistd.h functions
John W. Eaton <jwe@octave.org>
parents: 21876
diff changeset
44 #include "quit.h"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13924
diff changeset
45 #include "singleton-cleanup.h"
21944
4b2eab5d2a6a provide wrapper for strdup
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
46 #include "strdup-wrapper.h"
21910
4d723ba06b4a provide wrappers for some unistd.h functions
John W. Eaton <jwe@octave.org>
parents: 21876
diff changeset
47 #include "unistd-wrappers.h"
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
48
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
49 #if defined (USE_READLINE)
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
50 #include <cstdio>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
51
3519
957d7d6ab0e0 [project @ 2000-02-02 06:00:09 by jwe]
jwe
parents: 3504
diff changeset
52 #include "oct-rl-edit.h"
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
53 #endif
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
54
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31480
diff changeset
55 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31480
diff changeset
56
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
57 char * do_completer_word_break_hook ();
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
58
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
59 command_editor *command_editor::s_instance = nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
60
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
61 std::set<command_editor::startup_hook_fcn> command_editor::m_startup_hook_set;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
62
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
63 std::set<command_editor::pre_input_hook_fcn> command_editor::m_pre_input_hook_set;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
64
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
65 std::set<command_editor::event_hook_fcn> command_editor::m_event_hook_set;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
66
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
67 static mutex event_hook_lock;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
68
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
69 #if defined (USE_READLINE)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
70
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
71 class
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
72 gnu_readline : public command_editor
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
73 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
74 public:
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
75
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
76 typedef command_editor::startup_hook_fcn startup_hook_fcn;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
77
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
78 typedef command_editor::pre_input_hook_fcn pre_input_hook_fcn;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
79
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
80 typedef command_editor::event_hook_fcn event_hook_fcn;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
81
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
82 typedef command_editor::completion_fcn completion_fcn;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
83
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
84 gnu_readline (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
85
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
86 ~gnu_readline (void) = default;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
87
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
88 void do_set_name (const std::string& n);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
89
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
90 std::string do_readline (const std::string& prompt, bool& eof);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
91
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
92 void do_set_input_stream (FILE *f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
93
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
94 FILE * do_get_input_stream (void);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
95
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
96 void do_set_output_stream (FILE *f);
3519
957d7d6ab0e0 [project @ 2000-02-02 06:00:09 by jwe]
jwe
parents: 3504
diff changeset
97
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
98 FILE * do_get_output_stream (void);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
99
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
100 void do_redisplay (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
101
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
102 int do_terminal_rows (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
103
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
104 int do_terminal_cols (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
105
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
106 void do_clear_screen (bool skip_redisplay);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
107
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
108 void do_resize_terminal (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
109
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
110 void do_set_screen_size (int ht, int wd);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
111
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
112 std::string newline_chars (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
113
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
114 void do_restore_terminal_state (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
115
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
116 void do_blink_matching_paren (bool flag);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
117
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
118 bool do_erase_empty_line (bool flag);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
119
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
120 void do_set_basic_word_break_characters (const std::string& s);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
121
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
122 void do_set_completer_word_break_characters (const std::string& s);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
123
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
124 void do_set_basic_quote_characters (const std::string& s);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
125
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
126 void do_set_filename_quote_characters (const std::string& s);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
127
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
128 void do_set_completer_quote_characters (const std::string& s);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
129
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
130 void do_set_completion_append_character (char c);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
131
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
132 void do_set_completion_function (completion_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
133
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
134 void do_set_quoting_function (quoting_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
135
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
136 void do_set_dequoting_function (dequoting_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
137
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
138 void do_set_char_is_quoted_function (char_is_quoted_fcn f);
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
139
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
140 void do_set_user_accept_line_function (user_accept_line_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
141
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
142 completion_fcn do_get_completion_function (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
143
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
144 quoting_fcn do_get_quoting_function (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
145
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
146 dequoting_fcn do_get_dequoting_function (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
147
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
148 char_is_quoted_fcn do_get_char_is_quoted_function (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
149
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
150 user_accept_line_fcn do_get_user_accept_line_function (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
151
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
152 string_vector
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
153 do_generate_filename_completions (const std::string& text);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
154
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
155 std::string do_get_line_buffer (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
156
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
157 std::string do_get_current_line (void) const;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
158
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
159 char do_get_prev_char (int) const;
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
160
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
161 void do_replace_line (const std::string& text, bool clear_undo);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
162
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
163 void do_kill_full_line (void);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
164
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
165 void do_insert_text (const std::string& text);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
166
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
167 void do_newline (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
168
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
169 void do_accept_line (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
170
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
171 bool do_undo (void);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
172
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
173 void do_clear_undo_list (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
174
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
175 void set_startup_hook (startup_hook_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
176
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
177 void restore_startup_hook (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
178
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
179 void set_pre_input_hook (pre_input_hook_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
180
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
181 void restore_pre_input_hook (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
182
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
183 void set_event_hook (event_hook_fcn f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
184
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
185 void restore_event_hook (void);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
186
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
187 void do_restore_event_hook (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
188
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
189 void do_read_init_file (const std::string& file);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
190
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
191 void do_re_read_init_file (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
192
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
193 bool do_filename_completion_desired (bool);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
194
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
195 bool do_filename_quoting_desired (bool);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
196
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
197 bool do_prefer_env_winsize (bool);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
198
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
199 void do_interrupt (bool);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
200
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
201 void do_handle_interrupt_signal (void);
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
202
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
203 static int operate_and_get_next (int, int);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
204
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
205 static int history_search_backward (int, int);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
206
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
207 static int history_search_forward (int, int);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
208
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
209 private:
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
210
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
211 static char * command_generator (const char *text, int state);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
212
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
213 static char * command_quoter (char *text, int match_type,
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
214 char *quote_pointer);
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
215
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
216 static char * command_dequoter (char *text, int match_type);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
217
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
218 static int command_char_is_quoted (char *text, int index);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
219
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
220 static int command_accept_line (int count, int key);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
221
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
222 static char ** command_completer (const char *text, int start, int end);
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
223
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
224 static char * do_completer_word_break_hook ();
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
225
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
226 startup_hook_fcn m_previous_startup_hook;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
227
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
228 pre_input_hook_fcn m_previous_pre_input_hook;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
229
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
230 event_hook_fcn m_previous_event_hook;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
231
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
232 completion_fcn m_completion_function;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
233
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
234 quoting_fcn m_quoting_function;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
235
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
236 dequoting_fcn m_dequoting_function;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
237
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
238 char_is_quoted_fcn m_char_is_quoted_function;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
239
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
240 user_accept_line_fcn user_accept_line_function;
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
241
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
242 static std::string s_completer_quote_characters;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
243 };
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
244
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
245 std::string gnu_readline::s_completer_quote_characters = "";
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
246
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
247 gnu_readline::gnu_readline ()
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
248 : command_editor (), m_previous_startup_hook (nullptr),
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
249 m_previous_pre_input_hook (nullptr),
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
250 m_previous_event_hook (nullptr), m_completion_function (nullptr),
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
251 m_quoting_function (nullptr), m_dequoting_function (nullptr),
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
252 m_char_is_quoted_function (nullptr), user_accept_line_function (nullptr)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
253 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
254 // FIXME: need interface to rl_add_defun, rl_initialize, and
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
255 // a function to set rl_terminal_name
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
256
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
257 std::string term = sys::env::getenv ("TERM");
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
258
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
259 octave_rl_set_terminal_name (term.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
260
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
261 octave_rl_initialize ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
262
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
263 do_blink_matching_paren (true);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
264
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
265 // Bind operate-and-get-next.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
266
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
267 octave_rl_add_defun ("operate-and-get-next",
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
268 gnu_readline::operate_and_get_next,
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
269 octave_rl_ctrl ('O'));
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
270 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
271
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
272 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
273 gnu_readline::do_set_name (const std::string& nm)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
274 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
275 ::octave_rl_set_name (nm.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
276 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
277
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
278 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
279 gnu_readline::do_readline (const std::string& prompt, bool& eof)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
280 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
281 std::string retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
282
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
283 eof = false;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
284
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
285 const char *p = prompt.c_str ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
286
24566
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
287 char *line = ::octave_rl_readline (p);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
288
24566
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
289 if (line)
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
290 {
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
291 retval = line;
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
292
24566
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
293 free (line);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
294 }
24566
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
295 else
f5bcbd321ba1 don't trap the user in the readline loop (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
296 eof = true;
19309
735bc47d18af command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents: 19304
diff changeset
297
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
298 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
299 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
300
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
301 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
302 gnu_readline::do_set_input_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
303 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
304 ::octave_rl_set_input_stream (f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
305 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
306
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
307 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
308 gnu_readline::do_get_input_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
309 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
310 return ::octave_rl_get_input_stream ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
311 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
312
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
313 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
314 gnu_readline::do_set_output_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
315 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
316 ::octave_rl_set_output_stream (f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
317 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
318
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
319 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
320 gnu_readline::do_get_output_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
321 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
322 return ::octave_rl_get_output_stream ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
323 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
324
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
325 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
326 gnu_readline::do_redisplay (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
327 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
328 ::octave_rl_redisplay ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
329 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
330
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
331 // GNU readline handles SIGWINCH, so these values have a good chance
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
332 // of being correct even if the window changes size (they may be
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
333 // wrong if, for example, the luser changes the window size while the
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
334 // pager is running, and the signal is handled by the pager instead of
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
335 // us.
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
336
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
337 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
338 gnu_readline::do_terminal_rows (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
339 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
340 int sh = ::octave_rl_screen_height ();
19378
f7ccd02bc060 provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents: 19309
diff changeset
341
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
342 return sh > 0 ? sh : 24;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
343 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
344
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
345 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
346 gnu_readline::do_terminal_cols (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
347 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
348 int sw = ::octave_rl_screen_width ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
349
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
350 return sw > 0 ? sw : 80;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
351 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
352
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
353 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
354 gnu_readline::do_clear_screen (bool skip_redisplay)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
355 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
356 ::octave_rl_clear_screen (skip_redisplay);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
357 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
358
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
359 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
360 gnu_readline::do_resize_terminal (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
361 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
362 ::octave_rl_resize_terminal ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
363 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
364
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
365 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
366 gnu_readline::do_set_screen_size (int ht, int wd)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
367 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
368 ::octave_rl_set_screen_size (ht, wd);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
369 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
370
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
371 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
372 gnu_readline::newline_chars (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
373 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
374 return "\r\n";
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
375 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
376
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
377 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
378 gnu_readline::do_restore_terminal_state (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
379 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
380 ::octave_rl_restore_terminal_state ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
381 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
382
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
383 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
384 gnu_readline::do_blink_matching_paren (bool flag)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
385 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
386 ::octave_rl_enable_paren_matching (flag ? 1 : 0);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
387 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
388
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
389 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
390 gnu_readline::do_erase_empty_line (bool flag)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
391 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
392 return ::octave_rl_erase_empty_line (flag ? 1 : 0);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
393 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
394
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
395 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
396 gnu_readline::do_set_basic_word_break_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
397 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
398 ::octave_rl_set_basic_word_break_characters (s.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
399 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
400
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
401 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
402 gnu_readline::do_set_completer_word_break_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
403 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
404 ::octave_rl_set_completer_word_break_characters (s.c_str ());
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
405
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
406 ::octave_rl_set_completion_word_break_hook
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
407 (gnu_readline::do_completer_word_break_hook);
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
408
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
409 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
410
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
411 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
412 gnu_readline::do_set_basic_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
413 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
414 ::octave_rl_set_basic_quote_characters (s.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
415 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
416
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
417 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
418 gnu_readline::do_set_filename_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
419 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
420 ::octave_rl_set_filename_quote_characters (s.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
421 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
422
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
423 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
424 gnu_readline::do_set_completer_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
425 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
426 s_completer_quote_characters = s;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
427 }
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
428
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
429 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
430 gnu_readline::do_set_completion_append_character (char c)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
431 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
432 ::octave_rl_set_completion_append_character (c);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
433 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
434
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
435 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
436 gnu_readline::do_set_completion_function (completion_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
437 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
438 m_completion_function = f;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
439
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
440 rl_attempted_completion_fcn_ptr fp
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
441 = (f ? gnu_readline::command_completer : nullptr);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
442
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
443 ::octave_rl_set_completion_function (fp);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
444 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
445
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
446 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
447 gnu_readline::do_set_quoting_function (quoting_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
448 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
449 m_quoting_function = f;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
450
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
451 rl_quoting_fcn_ptr fp
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
452 = (f ? gnu_readline::command_quoter : nullptr);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
453
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
454 ::octave_rl_set_quoting_function (fp);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
455 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
456
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
457 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
458 gnu_readline::do_set_dequoting_function (dequoting_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
459 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
460 m_dequoting_function = f;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
461
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
462 rl_dequoting_fcn_ptr fp
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
463 = (f ? gnu_readline::command_dequoter : nullptr);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
464
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
465 ::octave_rl_set_dequoting_function (fp);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
466 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
467
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
468 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
469 gnu_readline::do_set_char_is_quoted_function (char_is_quoted_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
470 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
471 m_char_is_quoted_function = f;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
472
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
473 rl_char_is_quoted_fcn_ptr fp
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23696
diff changeset
474 = (f ? gnu_readline::command_char_is_quoted : nullptr);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
475
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
476 ::octave_rl_set_char_is_quoted_function (fp);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
477 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
478
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
479 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
480 gnu_readline::do_set_user_accept_line_function (user_accept_line_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
481 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
482 user_accept_line_function = f;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
483
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
484 if (f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
485 octave_rl_add_defun ("accept-line", gnu_readline::command_accept_line,
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
486 ::octave_rl_ctrl ('M'));
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
487 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
488 octave_rl_add_defun ("accept-line", ::octave_rl_newline,
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
489 ::octave_rl_ctrl ('M'));
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
490 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
491
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
492 gnu_readline::completion_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
493 gnu_readline::do_get_completion_function (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
494 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
495 return m_completion_function;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
496 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
497
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
498 gnu_readline::quoting_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
499 gnu_readline::do_get_quoting_function (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
500 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
501 return m_quoting_function;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
502 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
503
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
504 gnu_readline::dequoting_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
505 gnu_readline::do_get_dequoting_function (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
506 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
507 return m_dequoting_function;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
508 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
509
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
510 gnu_readline::char_is_quoted_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
511 gnu_readline::do_get_char_is_quoted_function (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
512 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
513 return m_char_is_quoted_function;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
514 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
515
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
516 gnu_readline::user_accept_line_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
517 gnu_readline::do_get_user_accept_line_function (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
518 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
519 return user_accept_line_function;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
520 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
521
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
522 // True if the last "word" of the string line (delimited by delim) is
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
523 // an existing directory. Used by do_completer_word_break_hook.
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
524
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
525 static bool
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
526 looks_like_filename (const char *line, char delim)
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
527 {
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
528 bool retval = false;
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
529
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
530 const char *s = strrchr (line, delim);
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
531
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
532 if (s)
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
533 {
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
534 // Remove incomplete component.
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
535 const char *f = strrchr (line, sys::file_ops::dir_sep_char ());
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
536
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
537 if (f && (s[1] == '~' || f != s))
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
538 {
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
539 // For something like "A /b", f==s; don't assume a file.
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
540
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
541 std::string candidate_filename = s+1;
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
542
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
543 candidate_filename = candidate_filename.substr (0, f - s);
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
544
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
545 // Handles any complete ~<username>, but doesn't expand usernames.
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
546
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
547 if (candidate_filename[0] == '~')
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
548 candidate_filename
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
549 = sys::file_ops::tilde_expand (candidate_filename);
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
550
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
551 sys::file_stat fs (candidate_filename);
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
552
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
553 retval = fs.is_dir ();
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
554 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
555 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
556
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
557 return retval;
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
558 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
559
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
560 // Decide whether to interpret partial commands like "abc/def" as a
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
561 // filename or division. Return the set of delimiters appropriate for
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
562 // the decision.
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
563
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
564 char *
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
565 gnu_readline::do_completer_word_break_hook ()
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
566 {
28752
810eb29fc227 maint: Use C++ raw string literals to simplify backlsashing.
Rik <rik@octave.org>
parents: 27923
diff changeset
567 static char *dir_sep = octave_strdup_wrapper (R"( '")");
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
568
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
569 std::string word;
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
570 std::string line = get_line_buffer ();
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
571
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
572 // For now, assume space or quote delimiter for file names.
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
573 const char *l = line.c_str ();
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
574
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
575 if (looks_like_filename (l, ' ') || looks_like_filename (l, '\'')
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
576 || looks_like_filename (l, '"'))
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
577 {
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 26489
diff changeset
578 ::octave_rl_set_completer_quote_characters
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
579 (s_completer_quote_characters.c_str ());
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
580
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
581 return dir_sep;
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
582 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
583 else
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
584 {
31480
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
585 static char *word_break_chars = nullptr;
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
586
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
587 ::octave_rl_set_completer_quote_characters ("");
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
588
31480
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
589 free (word_break_chars);
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
590
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
591 word_break_chars
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
592 = octave_strdup_wrapper (octave_rl_get_completer_word_break_characters ());
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
593
1bbcaa97b2dd adapt to rl_completer_word_break_characters being declared const
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
594 return word_break_chars;
21798
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
595 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
596 }
12e7456f7619 Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21748
diff changeset
597
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
598 string_vector
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
599 gnu_readline::do_generate_filename_completions (const std::string& text)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
600 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
601 string_vector retval;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
602
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
603 int n = 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
604 int count = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
605
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23450
diff changeset
606 char *fn = nullptr;
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
607
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
608 while (1)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
609 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
610 fn = ::octave_rl_filename_completion_function (text.c_str (), count);
4143
62afb31c1f85 [project @ 2002-11-01 17:27:38 by jwe]
jwe
parents: 4062
diff changeset
611
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
612 if (fn)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
613 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
614 if (count == n)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
615 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
616 // Famous last words: Most large directories will not
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
617 // have more than a few hundred files, so we should not
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
618 // resize too many times even if the growth is linear...
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
619 n += 100;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
620 retval.resize (n);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
621 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
622
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
623 retval[count++] = fn;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
624
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
625 free (fn);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
626 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
627 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
628 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
629 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
630
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
631 retval.resize (count);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
632
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
633 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
634 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
635
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
636 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
637 gnu_readline::do_get_line_buffer (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
638 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
639 return ::octave_rl_line_buffer ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
640 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
641
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
642 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
643 gnu_readline::do_get_current_line (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
644 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
645 std::string retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
646 char *buf = ::octave_rl_copy_line ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
647 retval = buf;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
648 free (buf);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
649 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
650 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
651
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
652 // Return the character (offset+1) to the left of the cursor,
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
653 // or '\0' if the cursor is at the start of the line.
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
654 char
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
655 gnu_readline::do_get_prev_char (int offset) const
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
656 {
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
657 const char *buf = ::octave_rl_line_buffer ();
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
658 int p = ::octave_rl_point ();
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
659
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
660 return p > offset ? buf[p - offset - 1] : '\0';
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
661 }
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
662
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
663 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
664 gnu_readline::do_replace_line (const std::string& text, bool clear_undo)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
665 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
666 ::octave_rl_replace_line (text.c_str (), clear_undo);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
667 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
668
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
669 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
670 gnu_readline::do_kill_full_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
671 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
672 ::octave_rl_kill_full_line ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
673 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
674
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
675 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
676 gnu_readline::do_insert_text (const std::string& text)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
677 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
678 ::octave_rl_insert_text (text.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
679 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
680
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
681 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
682 gnu_readline::do_newline (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
683 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
684 ::octave_rl_newline (1, '\n');
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
685 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
686
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
687 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
688 gnu_readline::do_accept_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
689 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
690 command_accept_line (1, '\n');
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
691 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
692
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
693 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
694 gnu_readline::do_undo (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
695 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
696 return ::octave_rl_do_undo ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
697 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
698
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
699 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
700 gnu_readline::do_clear_undo_list ()
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
701 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
702 ::octave_rl_clear_undo_list ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
703 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
704
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
705 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
706 gnu_readline::set_startup_hook (startup_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
707 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
708 m_previous_startup_hook = ::octave_rl_get_startup_hook ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
709
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
710 if (f != m_previous_startup_hook)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
711 ::octave_rl_set_startup_hook (f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
712 }
19378
f7ccd02bc060 provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents: 19309
diff changeset
713
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
714 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
715 gnu_readline::restore_startup_hook (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
716 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
717 ::octave_rl_set_startup_hook (m_previous_startup_hook);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
718 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
719
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
720 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
721 gnu_readline::set_pre_input_hook (pre_input_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
722 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
723 m_previous_pre_input_hook = ::octave_rl_get_pre_input_hook ();
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
724
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
725 if (f != m_previous_pre_input_hook)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
726 ::octave_rl_set_pre_input_hook (f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
727 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
728
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
729 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
730 gnu_readline::restore_pre_input_hook (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
731 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
732 ::octave_rl_set_pre_input_hook (m_previous_pre_input_hook);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
733 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
734
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
735 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
736 gnu_readline::set_event_hook (event_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
737 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
738 m_previous_event_hook = octave_rl_get_event_hook ();
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
739
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
740 ::octave_rl_set_event_hook (f);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
741 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
742
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
743 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
744 gnu_readline::restore_event_hook (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
745 {
30157
b709d7b41cf8 maint: use "m_" prefix for member variables in class gnu_readline.
Rik <rik@octave.org>
parents: 30154
diff changeset
746 ::octave_rl_set_event_hook (m_previous_event_hook);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
747 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
748
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
749 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
750 gnu_readline::do_read_init_file (const std::string& file)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
751 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
752 ::octave_rl_read_init_file (file.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
753 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
754
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
755 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
756 gnu_readline::do_re_read_init_file (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
757 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
758 ::octave_rl_re_read_init_file ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
759 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
760
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
761 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
762 gnu_readline::do_filename_completion_desired (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
763 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
764 return ::octave_rl_filename_completion_desired (arg);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
765 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
766
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
767 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
768 gnu_readline::do_filename_quoting_desired (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
769 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
770 return ::octave_rl_filename_quoting_desired (arg);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
771 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
772
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
773 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
774 gnu_readline::do_prefer_env_winsize (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
775 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
776 return ::octave_rl_prefer_env_winsize (arg);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
777 }
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
778
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
779 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
780 gnu_readline::do_interrupt (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
781 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
782 ::octave_rl_done (arg);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
783 }
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
784
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
785 void
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
786 gnu_readline::do_handle_interrupt_signal (void)
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
787 {
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
788 octave_signal_caught = 0;
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
789 octave_interrupt_state = 0;
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
790
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
791 ::octave_rl_recover_from_interrupt ();
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
792
25336
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
793 throw interrupt_exception ();
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
794 }
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
795
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
796 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
797 gnu_readline::operate_and_get_next (int /* count */, int /* c */)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
798 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
799 // Accept the current line.
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
800
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
801 command_editor::accept_line ();
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
802
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
803 // Find the current line, and find the next line to use.
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
804
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
805 int x_where = command_history::where ();
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
806
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
807 int x_length = command_history::length ();
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
808
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
809 if ((command_history::is_stifled ()
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
810 && (x_length >= command_history::max_input_history ()))
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
811 || (x_where >= x_length - 1))
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
812 command_history::set_mark (x_where);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
813 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
814 command_history::set_mark (x_where + 1);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
815
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
816 command_editor::add_startup_hook (command_history::goto_mark);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
817
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
818 return 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
819 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
820
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
821 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
822 gnu_readline::history_search_backward (int count, int c)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
823 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
824 return octave_rl_history_search_backward (count, c);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
825 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
826
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
827 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
828 gnu_readline::history_search_forward (int count, int c)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
829 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
830 return octave_rl_history_search_forward (count, c);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
831 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
832
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
833 char *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
834 gnu_readline::command_generator (const char *text, int state)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
835 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23450
diff changeset
836 char *retval = nullptr;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
837
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
838 completion_fcn f = command_editor::get_completion_function ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
839
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
840 std::string tmp = f (text, state);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
841
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
842 std::size_t len = tmp.length ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
843
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
844 if (len > 0)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
845 {
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21910
diff changeset
846 retval = static_cast<char *> (std::malloc (len+1));
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
847
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
848 if (retval)
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
849 strcpy (retval, tmp.c_str ());
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
850 }
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
851
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
852 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
853 }
7758
8e14a01ffe9f input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
854
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
855 char *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
856 gnu_readline::command_quoter (char *text, int matches, char *qcp)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
857 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23450
diff changeset
858 char *retval = nullptr;
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
859
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
860 quoting_fcn f = command_editor::get_quoting_function ();
19304
ad93e9be78ee command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
861
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
862 std::string tmp = f (text, matches, *qcp);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
863
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
864 std::size_t len = tmp.length ();
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
865
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
866 if (len > 0)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
867 {
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21910
diff changeset
868 retval = static_cast<char *> (std::malloc (len+1));
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
869
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
870 if (retval)
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
871 strcpy (retval, tmp.c_str ());
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
872 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
873
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
874 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
875 }
3519
957d7d6ab0e0 [project @ 2000-02-02 06:00:09 by jwe]
jwe
parents: 3504
diff changeset
876
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
877 char *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
878 gnu_readline::command_dequoter (char *text, int quote)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
879 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23450
diff changeset
880 char *retval = nullptr;
3951
e6f67a1ed814 [project @ 2002-05-23 03:41:25 by jwe]
jwe
parents: 3933
diff changeset
881
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
882 dequoting_fcn f = command_editor::get_dequoting_function ();
3951
e6f67a1ed814 [project @ 2002-05-23 03:41:25 by jwe]
jwe
parents: 3933
diff changeset
883
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
884 std::string tmp = f (text, quote);
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
885
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
886 std::size_t len = tmp.length ();
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
887
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
888 if (len > 0)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
889 {
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21910
diff changeset
890 retval = static_cast<char *> (std::malloc (len+1));
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
891
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
892 if (retval)
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
893 strcpy (retval, tmp.c_str ());
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
894 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
895
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
896 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
897 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
898
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
899 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
900 gnu_readline::command_char_is_quoted (char *text, int quote)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
901 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
902 char_is_quoted_fcn f = command_editor::get_char_is_quoted_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
903
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
904 return f (text, quote);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
905 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
906
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
907 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
908 gnu_readline::command_accept_line (int count, int key)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
909 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
910 user_accept_line_fcn f = command_editor::get_user_accept_line_function ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
911
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
912 if (f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
913 f (::octave_rl_line_buffer ());
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
914
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
915 ::octave_rl_redisplay ();
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
916
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
917 return ::octave_rl_newline (count, key);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
918 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
919
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
920 char **
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
921 gnu_readline::command_completer (const char *text, int, int)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
922 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27276
diff changeset
923 char **matches
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27276
diff changeset
924 = ::octave_rl_completion_matches (text, gnu_readline::command_generator);
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
925
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
926 return matches;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
927 }
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
928
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
929 #endif
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
930
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
931 class
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
932 default_command_editor : public command_editor
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
933 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
934 public:
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
935
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
936 default_command_editor (void)
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
937 : command_editor (), m_input_stream (stdin), m_output_stream (stdout) { }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
938
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
939 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
940
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
941 default_command_editor (const default_command_editor&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
942
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
943 default_command_editor& operator = (const default_command_editor&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
944
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
945 ~default_command_editor (void) = default;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
946
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
947 std::string do_readline (const std::string& prompt, bool& eof);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
948
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
949 void do_set_input_stream (FILE *f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
950
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
951 FILE * do_get_input_stream (void);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
952
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
953 void do_set_output_stream (FILE *f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
954
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
955 FILE * do_get_output_stream (void);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
956
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
957 string_vector do_generate_filename_completions (const std::string& text);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
958
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
959 std::string do_get_line_buffer (void) const;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
960
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
961 std::string do_get_current_line (void) const;
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
962
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
963 char do_get_prev_char (int) const;
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
964
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
965 void do_replace_line (const std::string& text, bool clear_undo);
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
966
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
967 void do_kill_full_line (void);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
968
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
969 void do_insert_text (const std::string& text);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
970
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
971 void do_newline (void);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
972
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
973 void do_accept_line (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
974
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
975 private:
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
976
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
977 FILE *m_input_stream;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
978
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
979 FILE *m_output_stream;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
980 };
12153
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
981
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
982 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
983 default_command_editor::do_readline (const std::string& prompt, bool& eof)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
984 {
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
985 std::fputs (prompt.c_str (), m_output_stream);
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
986 std::fflush (m_output_stream);
12153
e0e50f48df37 Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11586
diff changeset
987
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
988 return fgetl (m_input_stream, eof);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
989 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
990
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
991 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
992 default_command_editor::do_set_input_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
993 {
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
994 m_input_stream = f;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
995 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
996
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
997 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
998 default_command_editor::do_get_input_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
999 {
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
1000 return m_input_stream;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1001 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1002
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1003 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1004 default_command_editor::do_set_output_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1005 {
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
1006 m_output_stream = f;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1007 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1008
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1009 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1010 default_command_editor::do_get_output_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1011 {
30154
868156b5027b maint: use "m_" prefix for member variables in class default_command_editor.
Rik <rik@octave.org>
parents: 30152
diff changeset
1012 return m_output_stream;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1013 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1014
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1015 string_vector
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1016 default_command_editor::do_generate_filename_completions (const std::string&)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1017 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1018 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1019 return string_vector ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1020 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1021
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1022 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1023 default_command_editor::do_get_line_buffer (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1024 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1025 return "";
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1026 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1027
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1028 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1029 default_command_editor::do_get_current_line (void) const
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1030 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1031 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1032 return "";
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1033 }
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
1034
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1035 char
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1036 default_command_editor::do_get_prev_char (int) const
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1037 {
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1038 return '\0';
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1039 }
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1040
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1041 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1042 default_command_editor::do_replace_line (const std::string&, bool)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1043 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1044 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1045 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1046
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1047 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1048 default_command_editor::do_kill_full_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1049 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1050 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1051 }
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
1052
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1053 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1054 default_command_editor::do_insert_text (const std::string&)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1055 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1056 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1057 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1058
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1059 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1060 default_command_editor::do_newline (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1061 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1062 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1063 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1064
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1065 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1066 default_command_editor::do_accept_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1067 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1068 // FIXME
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1069 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1070
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1071 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1072 command_editor::instance_ok (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1073 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1074 bool retval = true;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1075
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1076 if (! s_instance)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1077 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1078 make_command_editor ();
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
1079
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1080 if (s_instance)
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1081 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1082 s_instance->set_event_hook (event_handler);
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1083
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1084 singleton_cleanup_list::add (cleanup_instance);
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1085 }
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1086 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1087
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1088 if (! s_instance)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1089 (*current_liboctave_error_handler)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1090 ("unable to create command history object!");
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1091
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1092 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1093 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1094
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1095 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1096 command_editor::make_command_editor (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1097 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1098 #if defined (USE_READLINE)
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1099 s_instance = new gnu_readline ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1100 #else
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1101 s_instance = new default_command_editor ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1102 #endif
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1103 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1104
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1105 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1106 command_editor::force_default_editor (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1107 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1108 delete s_instance;
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1109 s_instance = new default_command_editor ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1110 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13924
diff changeset
1111
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1112 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1113 command_editor::set_initial_input (const std::string& text)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1114 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1115 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1116 s_instance->m_initial_input = text;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1117 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1118
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1119 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1120 command_editor::insert_initial_input (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1121 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1122 return instance_ok () ? s_instance->do_insert_initial_input () : 0;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1123 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1124
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1125 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1126 command_editor::startup_handler (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1127 {
26486
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1128 // Iterate over a copy of the set to avoid problems if a hook
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1129 // function attempts to remove itself from the startup_hook_set.
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1130
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1131 std::set<startup_hook_fcn> hook_set = m_startup_hook_set;
26486
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1132
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1133 for (startup_hook_fcn f : hook_set)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1134 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1135 if (f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1136 f ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1137 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1138
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1139 return 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1140 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1141
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1142 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1143 command_editor::pre_input_handler (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1144 {
26486
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1145 // Iterate over copy of the set to avoid problems if a hook function
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1146 // attempts to remove itself from the pre_input_hook_set.
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1147
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1148 std::set<pre_input_hook_fcn> hook_set = m_pre_input_hook_set;
26486
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1149
d41c487e5de2 avoid possible crash while executing readline hook function (bug #55391)
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
1150 for (pre_input_hook_fcn f : hook_set)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1151 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1152 if (f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1153 f ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1154 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1155
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1156 return 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1157 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1158
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1159 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1160 command_editor::event_handler (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1161 {
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1162 if (octave_interrupt_state)
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1163 handle_interrupt_signal ();
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1164
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1165 event_hook_lock.lock ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1166
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1167 std::set<event_hook_fcn> hook_set (m_event_hook_set);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1168
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1169 event_hook_lock.unlock ();
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1170
22873
2830a770405b maint: Fix up more for loops with range operators in liboctave.
Rik <rik@octave.org>
parents: 22869
diff changeset
1171 for (event_hook_fcn f : hook_set)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1172 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1173 if (f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1174 f ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1175 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1176
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1177 return 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1178 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1179
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1180 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1181 command_editor::set_name (const std::string& n)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1182 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1183 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1184 s_instance->do_set_name (n);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1185 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1186
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1187 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1188 command_editor::readline (const std::string& prompt)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1189 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1190 bool eof;
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1191
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1192 return readline (prompt, eof);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1193 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1194
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1195 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1196 command_editor::readline (const std::string& prompt, bool& eof)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1197 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1198 std::string retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1199
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1200 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1201 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1202 if (! s_instance->m_initial_input.empty ())
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1203 add_pre_input_hook (command_editor::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
1204
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1205 retval = s_instance->do_readline (prompt, eof);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1206 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1207
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1208 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1209 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1210
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1211 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1212 command_editor::set_input_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1213 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1214 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1215 s_instance->do_set_input_stream (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1216 }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7758
diff changeset
1217
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1218 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1219 command_editor::get_input_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1220 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1221 return instance_ok () ? s_instance->do_get_input_stream () : nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1222 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1223
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1224 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1225 command_editor::set_output_stream (FILE *f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1226 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1227 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1228 s_instance->do_set_output_stream (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1229 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1230
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1231 FILE *
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1232 command_editor::get_output_stream (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1233 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1234 return instance_ok () ? s_instance->do_get_output_stream () : nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1235 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1236
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1237 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1238 command_editor::redisplay (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1239 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1240 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1241 s_instance->do_redisplay ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1242 }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3215
diff changeset
1243
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1244 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1245 command_editor::terminal_rows (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1246 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1247 return instance_ok () ? s_instance->do_terminal_rows () : -1;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1248 }
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3215
diff changeset
1249
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1250 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1251 command_editor::terminal_cols (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1252 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1253 return instance_ok () ? s_instance->do_terminal_cols () : -1;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1254 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1255
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1256 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1257 command_editor::clear_screen (bool skip_redisplay)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1258 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1259 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1260 s_instance->do_clear_screen (skip_redisplay);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1261 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1262
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1263 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1264 command_editor::resize_terminal (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1265 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1266 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1267 s_instance->do_resize_terminal ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1268 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1269
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1270 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1271 command_editor::set_screen_size (int ht, int wd)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1272 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1273 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1274 s_instance->do_set_screen_size (ht, wd);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1275 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1276
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1277 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1278 command_editor::decode_prompt_string (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1279 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1280 return instance_ok () ? s_instance->do_decode_prompt_string (s) : "";
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1281 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1282
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1283 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1284 command_editor::current_command_number (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1285 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1286 return instance_ok () ? s_instance->m_command_number : 0;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1287 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1288
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1289 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1290 command_editor::reset_current_command_number (int n)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1291 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1292 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1293 s_instance->m_command_number = n;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1294 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1295
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1296 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1297 command_editor::increment_current_command_number (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1298 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1299 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1300 s_instance->m_command_number++;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1301 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1302
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1303 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1304 command_editor::restore_terminal_state (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1305 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1306 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1307 s_instance->do_restore_terminal_state ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1308 }
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
1309
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1310 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1311 command_editor::blink_matching_paren (bool flag)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1312 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1313 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1314 s_instance->do_blink_matching_paren (flag);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1315 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1316
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1317 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1318 command_editor::erase_empty_line (bool flag)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1319 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1320 return instance_ok () ? s_instance->do_erase_empty_line (flag) : false;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1321 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1322
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1323 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1324 command_editor::set_basic_word_break_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1325 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1326 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1327 s_instance->do_set_basic_word_break_characters (s);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1328 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1329
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1330 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1331 command_editor::set_completer_word_break_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1332 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1333 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1334 s_instance->do_set_completer_word_break_characters (s);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1335 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1336
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1337 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1338 command_editor::set_basic_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1339 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1340 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1341 s_instance->do_set_basic_quote_characters (s);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1342 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1343
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1344 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1345 command_editor::set_filename_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1346 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1347 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1348 s_instance->do_set_filename_quote_characters (s);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1349 }
3281
aaaa20d31a5f [project @ 1999-10-13 07:02:46 by jwe]
jwe
parents: 3260
diff changeset
1350
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1351 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1352 command_editor::set_completer_quote_characters (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1353 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1354 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1355 s_instance->do_set_completer_quote_characters (s);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1356 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1357
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1358 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1359 command_editor::set_completion_append_character (char c)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1360 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1361 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1362 s_instance->do_set_completion_append_character (c);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1363 }
19309
735bc47d18af command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents: 19304
diff changeset
1364
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1365 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1366 command_editor::set_completion_function (completion_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1367 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1368 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1369 s_instance->do_set_completion_function (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1370 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1371
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1372 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1373 command_editor::set_quoting_function (quoting_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1374 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1375 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1376 s_instance->do_set_quoting_function (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1377 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1378
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1379 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1380 command_editor::set_dequoting_function (dequoting_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1381 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1382 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1383 s_instance->do_set_dequoting_function (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1384 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1385
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1386 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1387 command_editor::set_char_is_quoted_function (char_is_quoted_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1388 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1389 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1390 s_instance->do_set_char_is_quoted_function (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1391 }
2967
467aae13b70a [project @ 1997-05-15 16:47:12 by jwe]
jwe
parents: 2941
diff changeset
1392
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1393 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1394 command_editor::set_user_accept_line_function (user_accept_line_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1395 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1396 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1397 s_instance->do_set_user_accept_line_function (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1398 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1399
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1400 command_editor::completion_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1401 command_editor::get_completion_function (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1402 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1403 return instance_ok () ? s_instance->do_get_completion_function () : nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1404 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1405
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1406 command_editor::quoting_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1407 command_editor::get_quoting_function (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1408 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1409 return instance_ok () ? s_instance->do_get_quoting_function () : nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1410 }
19378
f7ccd02bc060 provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents: 19309
diff changeset
1411
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1412 command_editor::dequoting_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1413 command_editor::get_dequoting_function (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1414 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1415 return instance_ok () ? s_instance->do_get_dequoting_function () : nullptr;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1416 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
1417
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1418 command_editor::char_is_quoted_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1419 command_editor::get_char_is_quoted_function (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1420 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1421 return (instance_ok ()
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1422 ? s_instance->do_get_char_is_quoted_function () : nullptr);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1423 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3779
diff changeset
1424
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1425 command_editor::user_accept_line_fcn
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1426 command_editor::get_user_accept_line_function (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1427 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1428 return (instance_ok ()
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1429 ? s_instance->do_get_user_accept_line_function () : nullptr);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1430 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1431
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1432 string_vector
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1433 command_editor::generate_filename_completions (const std::string& text)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1434 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1435 return (instance_ok ()
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1436 ? s_instance->do_generate_filename_completions (text)
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1437 : string_vector ());
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1438 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1439
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1440 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1441 command_editor::get_line_buffer (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1442 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1443 return instance_ok () ? s_instance->do_get_line_buffer () : "";
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1444 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1445
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1446 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1447 command_editor::get_current_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1448 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1449 return instance_ok () ? s_instance->do_get_current_line () : "";
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1450 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1451
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1452 // Return the character (offset+1) to the left of the cursor,
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1453 // or '\0' if the cursor is at the start of the line.
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1454 char
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1455 command_editor::get_prev_char (int offset)
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1456 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1457 return instance_ok () ? s_instance->do_get_prev_char (offset) : '\0';
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1458 }
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22022
diff changeset
1459
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1460 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1461 command_editor::replace_line (const std::string& text, bool clear_undo)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1462 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1463 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1464 s_instance->do_replace_line (text, clear_undo);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1465 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1466
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1467 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1468 command_editor::kill_full_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1469 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1470 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1471 s_instance->do_kill_full_line ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1472 }
2941
b779a5b8aed4 [project @ 1997-05-08 02:14:34 by jwe]
jwe
parents: 2926
diff changeset
1473
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1474 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1475 command_editor::insert_text (const std::string& text)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1476 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1477 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1478 s_instance->do_insert_text (text);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1479 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1480
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1481 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1482 command_editor::newline (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1483 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1484 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1485 s_instance->do_newline ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1486 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1487
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1488 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1489 command_editor::accept_line (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1490 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1491 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1492 s_instance->do_accept_line ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1493 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1494
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1495 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1496 command_editor::undo (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1497 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1498 return instance_ok () ? s_instance->do_undo () : false;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1499 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1500
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1501 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1502 command_editor::clear_undo_list (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1503 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1504 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1505 s_instance->do_clear_undo_list ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1506 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1507
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1508 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1509 command_editor::add_startup_hook (startup_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1510 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1511 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1512 {
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1513 m_startup_hook_set.insert (f);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1514
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1515 s_instance->set_startup_hook (startup_handler);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1516 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1517 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1518
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1519 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1520 command_editor::remove_startup_hook (startup_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1521 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1522 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1523 {
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1524 auto p = m_startup_hook_set.find (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1525
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1526 if (p != m_startup_hook_set.end ())
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1527 m_startup_hook_set.erase (p);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1528
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1529 if (m_startup_hook_set.empty ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1530 s_instance->restore_startup_hook ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1531 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1532 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1533
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1534 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1535 command_editor::add_pre_input_hook (pre_input_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1536 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1537 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1538 {
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1539 m_pre_input_hook_set.insert (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1540
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1541 s_instance->set_pre_input_hook (pre_input_handler);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1542 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1543 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1544
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1545 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1546 command_editor::remove_pre_input_hook (pre_input_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1547 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1548 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1549 {
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1550 auto p = m_pre_input_hook_set.find (f);
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1551
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1552 if (p != m_pre_input_hook_set.end ())
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1553 m_pre_input_hook_set.erase (p);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1554
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1555 if (m_pre_input_hook_set.empty ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1556 s_instance->restore_pre_input_hook ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1557 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1558 }
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4527
diff changeset
1559
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1560 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1561 command_editor::add_event_hook (event_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1562 {
23057
bb7513d73673 move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22873
diff changeset
1563 autolock guard (event_hook_lock);
9485
3cee58bf4acf selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents: 9321
diff changeset
1564
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1565 m_event_hook_set.insert (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1566 }
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1567
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1568 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1569 command_editor::remove_event_hook (event_hook_fcn f)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1570 {
23057
bb7513d73673 move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22873
diff changeset
1571 autolock guard (event_hook_lock);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1572
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1573 auto p = m_event_hook_set.find (f);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1574
30152
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1575 if (p != m_event_hook_set.end ())
f6fe2dcaffaf maint: use "m_" prefix for member variables in class command_editor.
Rik <rik@octave.org>
parents: 29937
diff changeset
1576 m_event_hook_set.erase (p);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1577
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1578 }
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
1579
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1580 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1581 command_editor::run_event_hooks (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1582 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1583 event_handler ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1584 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1585
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1586 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1587 command_editor::read_init_file (const std::string& file_arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1588 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1589 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1590 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1591 std::string file = sys::file_ops::tilde_expand (file_arg);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1592
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1593 s_instance->do_read_init_file (file);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1594 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1595 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1596
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1597 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1598 command_editor::re_read_init_file (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1599 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1600 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1601 s_instance->do_re_read_init_file ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1602 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1603
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1604 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1605 command_editor::filename_completion_desired (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1606 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1607 return (instance_ok ()
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1608 ? s_instance->do_filename_completion_desired (arg) : false);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1609 }
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1610
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1611 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1612 command_editor::filename_quoting_desired (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1613 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1614 return (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1615 ? s_instance->do_filename_quoting_desired (arg) : false;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1616 }
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16537
diff changeset
1617
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1618 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1619 command_editor::prefer_env_winsize (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1620 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1621 return instance_ok () ? s_instance->do_prefer_env_winsize (arg) : false;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1622 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1623
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1624 bool
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1625 command_editor::interrupt (bool arg)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1626 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1627 bool retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1628
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1629 if (instance_ok ())
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1630 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1631 // Return the current interrupt state.
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1632 retval = s_instance->m_interrupted;
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1633
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1634 s_instance->do_interrupt (arg);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1635
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1636 s_instance->m_interrupted = arg;
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1637 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1638 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1639 retval = false;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1640
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1641 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1642 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1643
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1644 void
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1645 command_editor::interrupt_event_loop (bool arg)
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1646 {
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1647 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1648 s_instance->do_interrupt_event_loop (arg);
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1649 }
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1650
27338
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1651 bool
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27338
diff changeset
1652 command_editor::event_loop_interrupted (void)
27338
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1653 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1654 return instance_ok () ? s_instance->do_event_loop_interrupted () : false;
27338
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1655 }
829d9efb7730 allow gui events to interrupt readline event processing (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1656
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1657 void
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1658 command_editor::handle_interrupt_signal (void)
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1659 {
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1660 if (instance_ok ())
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1661 s_instance->do_handle_interrupt_signal ();
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1662 }
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 23824
diff changeset
1663
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1664 // Return a string which will be printed as a prompt. The string may
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1665 // contain special characters which are decoded as follows:
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1666 //
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1667 // \a bell (ascii 07)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1668 // \d the date
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1669 // \e escape (ascii 033)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1670 // \h the hostname up to the first '.'
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1671 // \H the hostname
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1672 // \n CRLF
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1673 // \r CR
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1674 // \s the name of the shell (program)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1675 // \t the time
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1676 // \T the time in 12-hour hh:mm:ss format
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1677 // \@ the time in 12-hour hh:mm am/pm format
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1678 // \A the time in 24-hour hh:mm format
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1679 // \u your username
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1680 // \w the current working directory
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1681 // \W the last element of PWD
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1682 // \! the history number of this command
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1683 // \# the command number of this command
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1684 // \$ a $ or a # if you are root
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1685 // \nnn character code nnn in octal
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1686 // \\ a backslash
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1687 // \[ begin a sequence of non-printing chars
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1688 // \] end a sequence of non-printing chars
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1689
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1690 std::string
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1691 command_editor::do_decode_prompt_string (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1692 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1693 std::string retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1694 std::string tmpstr;
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1695 std::size_t i = 0;
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1696 std::size_t slen = s.length ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1697 int c;
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1698
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1699 while (i < slen)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1700 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1701 c = s[i];
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1702
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1703 i++;
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1704
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1705 if (c == '\\')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1706 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1707 c = s[i];
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1708
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1709 switch (c)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1710 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1711 case '0':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1712 case '1':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1713 case '2':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1714 case '3':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1715 case '4':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1716 case '5':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1717 case '6':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1718 case '7':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1719 // Maybe convert an octal number.
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1720 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1721 int n = read_octal (s.substr (i, 3));
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7758
diff changeset
1722
23824
061a343089be Miscellaneous cleanups of C++11 std::string code.
Rik <rik@octave.org>
parents: 23812
diff changeset
1723 tmpstr = '\\';
3215
bc3fdfe311a3 [project @ 1998-11-10 14:06:21 by jwe]
jwe
parents: 3189
diff changeset
1724
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1725 if (n != -1)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1726 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1727 tmpstr[0] = n;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1728 i += 2; // i++ makes this += 3 later
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1729 }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7758
diff changeset
1730
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1731 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1732 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1733
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1734 case 'a':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1735 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1736 tmpstr = '\a';
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1737
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1738 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1739 }
6913
f779c83d6ccf [project @ 2007-09-18 18:58:12 by jwe]
jwe
parents: 5872
diff changeset
1740
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1741 case 'd':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1742 case 't':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1743 case 'T':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1744 case '@':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1745 case 'A':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1746 // Make the current time/date into a string.
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1747 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1748 sys::localtime now;
13924
3b654a0753b1 Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12912
diff changeset
1749
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1750 if (c == 'd')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1751 tmpstr = now.strftime ("%a %b %d");
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1752 else if (c == 't')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1753 tmpstr = now.strftime ("%H:%M:%S");
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1754 else if (c == 'T')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1755 tmpstr = now.strftime ("%I:%M:%S");
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1756 else if (c == '@')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1757 tmpstr = now.strftime ("%I:%M %p");
26489
8f425e6ea110 cmd-edit.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26486
diff changeset
1758 else // (c == 'A')
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1759 tmpstr = now.strftime ("%H:%M");
5872
44f24cf66b95 [project @ 2006-06-30 18:19:20 by jwe]
jwe
parents: 5775
diff changeset
1760
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1761 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1762 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1763
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1764 case 'e':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1765 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1766 tmpstr = '\033';
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3145
diff changeset
1767
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1768 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1769 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1770
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1771 case 'h':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1772 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1773 tmpstr = sys::env::get_host_name ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1774
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1775 std::size_t pos = tmpstr.find ('.');
7758
8e14a01ffe9f input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
1776
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1777 if (pos != std::string::npos)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1778 tmpstr.resize (pos);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1779
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1780 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1781 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1782
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1783 case 'H':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1784 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1785 tmpstr = sys::env::get_host_name ();
4143
62afb31c1f85 [project @ 2002-11-01 17:27:38 by jwe]
jwe
parents: 4062
diff changeset
1786
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1787 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1788 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1789
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1790 case 'n':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1791 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1792 tmpstr = newline_chars ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1793
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1794 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1795 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1796
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1797 case 'r':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1798 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1799 tmpstr = '\r';
6979
2883ea1c5c18 [project @ 2007-10-08 20:23:48 by dbateman]
dbateman
parents: 6940
diff changeset
1800
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1801 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1802 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1803
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1804 case 's':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1805 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1806 tmpstr = sys::env::get_program_name ();
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1807 tmpstr = sys::env::base_pathname (tmpstr);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1808
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1809 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1810 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1811
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1812 case 'u':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1813 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1814 tmpstr = sys::env::get_user_name ();
19302
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 17769
diff changeset
1815
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1816 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1817 }
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
1818
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1819 case 'w':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1820 case 'W':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1821 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1822 try
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1823 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1824 tmpstr = sys::env::get_current_directory ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1825 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1826 catch (const execution_exception&)
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1827 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1828 tmpstr = "";
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1829 }
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
1830
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1831 std::string home_dir = sys::env::get_home_directory ();
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1832
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1833 if (c == 'W' && (home_dir.empty () || tmpstr != home_dir))
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1834 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1835 if (tmpstr != "/" && tmpstr != "//")
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1836 {
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1837 std::size_t pos = tmpstr.rfind ('/');
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
1838
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1839 if (pos != std::string::npos && pos != 0)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1840 tmpstr = tmpstr.substr (pos + 1);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1841 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1842 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1843 else
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
1844 tmpstr = sys::env::polite_directory_format (tmpstr);
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
1845
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1846 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1847 }
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
1848
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1849 case '!':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1850 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1851 char number_buffer[32];
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1852 int num = command_history::current_number ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1853 if (num > 0)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1854 sprintf (number_buffer, "%d", num);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1855 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1856 strcpy (number_buffer, "!");
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1857 tmpstr = number_buffer;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1858
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1859 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1860 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1861
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1862 case '#':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1863 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1864 char number_buffer[32];
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1865 sprintf (number_buffer, "%d", m_command_number);
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1866 tmpstr = number_buffer;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1867
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1868 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1869 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1870
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1871 case '$':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1872 {
21910
4d723ba06b4a provide wrappers for some unistd.h functions
John W. Eaton <jwe@octave.org>
parents: 21876
diff changeset
1873 tmpstr = (octave_geteuid_wrapper () == 0 ? '#' : '$');
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1874 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1875 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1876
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1877 #if defined (USE_READLINE)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1878 case '[':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1879 case ']':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1880 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1881 tmpstr.resize (1);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1882
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1883 tmpstr[0] = ((c == '[')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1884 ? ::octave_rl_prompt_start_ignore ()
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1885 : ::octave_rl_prompt_end_ignore ());
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1886
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1887 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1888 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1889 #endif
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1890
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1891 case '\\':
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1892 {
23824
061a343089be Miscellaneous cleanups of C++11 std::string code.
Rik <rik@octave.org>
parents: 23812
diff changeset
1893 tmpstr = '\\';
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1894
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1895 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1896 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1897
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1898 default:
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1899 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1900 tmpstr = "\\ ";
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1901 tmpstr[1] = c;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1902
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1903 break;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1904 }
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10250
diff changeset
1905 }
5442
636886245488 [project @ 2005-09-07 21:42:26 by jwe]
jwe
parents: 5336
diff changeset
1906
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1907 retval.append (tmpstr);
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1908 i++; // Move past processed escape character
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1909 }
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1910 else
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1911 retval += c;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1912 }
21168
26f85aa072de maint: Replace instances of goto in liboctave where convenient.
Rik <rik@octave.org>
parents: 21136
diff changeset
1913
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1914 return retval;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1915 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1916
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1917 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1918 command_editor::do_insert_initial_input (void)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1919 {
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1920 std::string input = m_initial_input;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1921
27379
3db033e86376 use m_ prefix for data members in most liboctave/util classes
John W. Eaton <jwe@octave.org>
parents: 27339
diff changeset
1922 m_initial_input = "";
21168
26f85aa072de maint: Replace instances of goto in liboctave where convenient.
Rik <rik@octave.org>
parents: 21136
diff changeset
1923
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1924 do_insert_text (input);
5442
636886245488 [project @ 2005-09-07 21:42:26 by jwe]
jwe
parents: 5336
diff changeset
1925
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1926 // Is it really right to redisplay here?
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1927 do_redisplay ();
5442
636886245488 [project @ 2005-09-07 21:42:26 by jwe]
jwe
parents: 5336
diff changeset
1928
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1929 return 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1930 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1931
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1932 // Return the octal number parsed from STRING, or -1 to indicate that
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1933 // the string contained a bad number.
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1934
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1935 int
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1936 command_editor::read_octal (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1937 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1938 int result = 0;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1939 int digits = 0;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1940
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1941 std::size_t i = 0;
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1942 std::size_t slen = s.length ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1943
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1944 while (i < slen && s[i] >= '0' && s[i] < '8')
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1945 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1946 digits++;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1947 result = (result * 8) + s[i] - '0';
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1948 i++;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1949 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1950
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1951 if (! digits || result > 0777 || i < slen)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1952 result = -1;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1953
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1954 return result;
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1955 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1956
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1957 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1958 command_editor::error (int err_num)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1959 {
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21910
diff changeset
1960 (*current_liboctave_error_handler) ("%s", std::strerror (err_num));
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1961 }
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
1962
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1963 void
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1964 command_editor::error (const std::string& s)
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1965 {
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1966 (*current_liboctave_error_handler) ("%s", s.c_str ());
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21733
diff changeset
1967 }
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31480
diff changeset
1968
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31480
diff changeset
1969 OCTAVE_END_NAMESPACE(octave)