Commit Graph

96 Commits

Author SHA1 Message Date
christos
ff1a7c8cc8 Only FLUSH if we are ending libedit; DRAIN if we suspend for readline.
This allows pasting multiline buffers (Gerry Swislow)
2018-01-01 22:32:46 +00:00
christos
b2ad969a13 For readline emulation, don't reset the tty to "sane" (cooked) mode if we
did not start this way. Also set and reset the tty on entry and exit from
readline() since this is what readline does.
2017-09-05 18:07:59 +00:00
christos
9abf018dda add literal escape sequence support, patterned after the tcsh ones. 2017-06-27 23:25:13 +00:00
kre
4fa1b5993a Make the default editrc file be $EDITRC (from env) if set, falling back
to $HOME/.editrc otherwise.    Better support for this in sh coming.
2017-06-27 00:47:37 +00:00
christos
bb64d9f1ce Stop the read module from poking the el_chared.c_macro data structure
currently belonging to the chared module.  The read module does so
from three of its functions, while no other module uses the macro
data, not even the chared module itself.  That's quite logical
because macros are a feature of input handling, all of which is
done by the read module, and none by the chared module.  So move
the data into the read modules's own opaque data structure, struct
el_read_t.

That simplifies internal interfaces in several respects: The
semi-public chared.h has one fewer struct, one fewer #define, and
one fewer member in struct el_chared_t; all three move to one single
C file, read.c, and are now module-local.  And the internal interface
function ch_reset() needs one fewer argument, making the code of many
functions in various modules more readable.

The price is one additional internal interface function, read_end(),
10 lines long including comments, called publicly from exactly one
place: el_end() in el.c.  That's hardly an increase in complexity
since most other modules already have their *_end() function, read.c
was the odd one out not having one.

From Ingo Schwarze
2016-05-22 19:44:26 +00:00
christos
a2d6b270ec s/protected/libedit_private/g 2016-05-09 21:46:56 +00:00
christos
300e2ca473 eliminate static buffer with custom resizing code. 2016-05-02 16:48:34 +00:00
christos
1364b6032a From Ingo Schwarze:
- Put the data type el_rfunc_t into the public header <histedit.h>.
 - Make el_read in struct editline an opaque pointer rather
   than an embedded struct.
 - Do not include "read.h" everywhere, but only in the two files
   needing access to el_read, read.c and el.c.
 - To functions that don't need more, pass the struct el_read_t *
   rather than the full EditLine *.
 - Of course, that means that read_init() can now fail from
   memory exhaustion, but it's easy to clean up after that.
2016-04-19 19:50:53 +00:00
christos
469d44f8e7 Get rid of private/public; keep protected (Ingo Schwarze) 2016-04-11 18:56:31 +00:00
christos
0594af8028 Char -> wchar_t from Ingo Schwarze. 2016-04-11 00:50:13 +00:00
christos
0aefc7f9ad more macro WIDECHAR undoing from Ingo Schwarze. 2016-04-11 00:22:48 +00:00
christos
fcf85103b4 More WIDECHAR elimination (Ingo Schwarze) 2016-04-09 18:43:17 +00:00
christos
4e541d85ca Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)
2016-03-23 22:27:48 +00:00
christos
94623721e8 Make the read_char function always take a wchar_t * argument (Ingo Schwarze) 2016-02-24 17:13:22 +00:00
christos
22383670cc whitespace and header sorting changes (Ingo Schwarze). No functional changes. 2016-02-17 19:47:49 +00:00
christos
747f681109 more include file cleanup (Ingo Schwarze) 2016-02-16 19:08:41 +00:00
christos
aefc1e4460 From Ingo Scharze:
Let "el.h" include everything needed for struct editline,
and don't include that stuff multiple times.  That also improves
consistency, also avoids circular inclusions, and also makes it
easier to follow what is going on, even though not quite as nice.
But it seems like the best we can do...
2016-02-16 15:53:48 +00:00
christos
f09cb8c626 cleanup chartype.h includes (Ingo Schwarze) 2016-02-16 14:08:25 +00:00
christos
40850369f8 cleanup inclusion of histedit.h (Ingo Schwarze) 2016-02-16 14:06:05 +00:00
christos
a7ab79fbe5 Use getline for better portability. 2016-02-15 15:53:45 +00:00
christos
70a36d136a use fparseln() to avoid needing to deal with missing \n in the last line
and also to handle comments automatically.
2016-02-15 15:18:01 +00:00
christos
6af8d6733f - Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)
2016-02-11 19:21:04 +00:00
christos
a2993d741e Only reset the terminal if we have a tty (Boris Ranto) 2015-12-08 12:56:55 +00:00
christos
e06822a79d Don't depend on weak aliases to define the vi "alias" expansion function,
provide an API instead to set it.
2014-06-18 18:12:28 +00:00
christos
40b42dfe79 provide an el_init_fd function. 2013-01-22 20:23:21 +00:00
christos
82f197ec94 PR/46942: Steffen Nurpmeso: editline(3): el_get(): fix UNBUFFERED return 2012-09-11 11:58:53 +00:00
christos
75b1bb5aad use arraycount 2012-03-11 21:14:56 +00:00
christos
9bee9dd870 remove unrecheable code (Kamil Dudka) 2011-11-18 20:22:03 +00:00
christos
b71bed95b3 KNF return (\1); -> return \1; 2011-07-29 15:16:33 +00:00
christos
a13cd75612 kill ptr_t and ioctl_t, add * sizeof(*foo) to all allocations. 2011-07-28 20:50:55 +00:00
christos
d47f958456 Rename key to keymacro to avoid conflicts with term.h. The renaming of term
to terminal was again to avoid conflicts with term.h. term.h is a moving
namespace violation.
2011-07-28 01:56:26 +00:00
christos
fd46b57ee4 avoid shadowed variable 2011-07-28 01:04:41 +00:00
christos
82edb784c6 term -> terminal
eliminate MAXPATHLEN
2011-07-28 00:49:18 +00:00
christos
3021376b9c don't stop reading after empty lines from: Nirbhay Choubey 2011-07-26 21:03:17 +00:00
bouyer
6d537d7313 Fix use-after-free. Discovered by running tests with MALLOC_OPTIONS=J
(should this be the default for tests ?), pointed out by njoly@
2011-03-20 12:36:14 +00:00
christos
b2ce31d086 don't turn on editing if stdout is not a tty. 2011-01-27 23:11:40 +00:00
christos
7741aae941 setup a callback to be invoked on resize buffers so that readline can
reset rl_line_buffer which unfortunately some applications use it directly.
2010-08-28 15:44:59 +00:00
christos
5443e9b772 From Jess Thrysoee
- use nl_langinfo to test for UTF-8, because some locales are UTF-8 without
     reflecting it in their names.
2010-04-15 00:56:40 +00:00
christos
dc8498bec8 - Document and enable wide character support.
- Fix read function compatibility.
2009-12-31 15:58:26 +00:00
christos
0b9ae3fdf0 Fix wide build, test it, but don't turn it on yet. 2009-12-30 23:54:52 +00:00
christos
34e53048e6 Wide character support (UTF-8) from Johny Mattsson; currently disabled. 2009-12-30 22:37:40 +00:00
christos
085c78fd1f Ignore comment lines in .editrc from Jess Thrysoee 2009-07-25 21:19:23 +00:00
christos
bafe66c2cc Only need path if we have issetugid... From Anon Ymous 2009-07-22 18:25:26 +00:00
christos
17a17e3aeb Move filename to the scope it is being used.
From Michael Cook mcook at bbn dot com
2009-07-22 15:56:29 +00:00
christos
b627b61f7f restore binary compatibility by providing new prompt functions that take
an extra literal character.
2009-05-11 18:33:30 +00:00
christos
c8754a5b44 Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)
2009-03-31 17:38:27 +00:00
christos
c51877c3f4 back out all prompt changes. they are not needed. 2009-02-21 00:05:23 +00:00
cube
0931c75c7a Order of evaluation of arguments is undefined, so call va_arg() in an
explicit order.  Fixes a segfault with bc reported by Patrick Welche on
current-users.
2009-02-19 20:27:11 +00:00
christos
62dbbc55bc allow for a prompt argument. 2009-02-17 21:34:26 +00:00
lukem
a06595c27b fix -Wsign-compare issues 2009-01-18 12:14:16 +00:00