Commit Graph

68 Commits

Author SHA1 Message Date
christos 85390d7315 Add a couple more readline compat functions. 2018-12-02 16:58:13 +00:00
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 a2d6b270ec s/protected/libedit_private/g 2016-05-09 21:46:56 +00:00
christos 4fc1f47d56 From Ingo Schwarze:
* Replace fcns.c by a shorter and simpler func.h
   and include it only in the one file needing it, map.c.
 * Combine help.h and help.c into a simplified help.h
   and include it only in the one file needing it, map.c.
 * Check the very simple, static files editline.c, historyn.c, and
   tokenizern.c into CVS rather than needlessly generating them.
 * So we no longer autogenerate any C files.  :-)
 * Shorten and simplify makelist by deleting the options -n, -e, -bc,
   and -m; the latter was unused and useless in the first place.
 * Move the declaration of el_func_t from fcns.h to the header
   actually needing it, map.h.  Since that header is already
   included by el.h for unrelated reasons, that makes el_func_t
   just as globally available as before.
 * No longer include the simplified fcns.h into el.h,
   include it directly into the *.c files needing it.
2016-04-18 17:01:19 +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 6b5dea1b27 Fix reversed condition in tty_end() (Ingo Schwarze)
Also don't succeed if calling setup twice.
2016-03-22 01:34:32 +00:00
christos a1f44db787 PR/50863: John Hein: libedit el_end() messes up term settings if piped
Keep track if we initialized the tty, and only reset it if we did.
2016-02-27 18:13:21 +00:00
christos 22383670cc whitespace and header sorting changes (Ingo Schwarze). No functional changes. 2016-02-17 19:47:49 +00:00
christos e84df91e32 More header cleanups from Ingo Schwarze. 2016-02-16 22:53:14 +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 f54e4f97f9 From Ingo Schwarze:
As we have seen before, "histedit.h" can never get rid of including
the <wchar.h> header because using the data types defined there is
deeply ingrained in the public interfaces of libedit.

Now POSIX unconditionally requires that <wchar.h> defines the type
wint_t.  Consequently, it can be used unconditionally, no matter
whether WIDECHAR is active or not.  Consequently, the #define Int
is pointless.

Note that removing it is not gratuitious churn.  Auditing for
integer signedness problems is already hard when only fundamental
types like "int" and "unsigned" are involved.  It gets very hard
when types come into the picture that have platform-dependent
signedness, like "char" and "wint_t".  Adding yet another layer
on top, changing both the signedness and the width in a platform-
dependent way, makes auditing yet harder, which IMHO is really
dangerous.  Note that while removing the #define, i already found
one bug caused by this excessive complication - in the function
re_putc() in refresh.c.  If WIDECHAR was defined, it printed an
Int = wint_t value with %c.  Fortunately, that bug only affects
debugging, not production.  The fix is contained in the patch.

With WIDECHAR, this doesn't change anything.  For the case without
WIDECHAR, i checked that none of the places wants to store values
that might not fit in wint_t.

This only changes internal interfaces; public ones remain unchanged.
2016-02-14 14:49:34 +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
gson 07d2388506 unbreak the build 2015-12-08 16:53:27 +00:00
christos 8d14d38c26 If we did not setup the tty, don't reset it. 2015-12-08 12:57:16 +00:00
christos d2ed0c780a fix warnings on ubuntu 32 bit (Miki Rozloznik) 2015-05-14 10:44:15 +00:00
christos cc52c7c3a4 Add stdlib.h for abort() (Jess Thrysoee) 2014-06-18 18:52:49 +00:00
christos 72aae1aa72 PR/48821: If called from tty_stty(), recalculate flags. 2014-05-19 21:01:48 +00:00
christos 75ef7650b2 more tty modes refactoring, no functional change intended. 2014-05-19 19:54:12 +00:00
christos ed36ef9858 Factor out some common code (more to be done) from PR/48821 2014-05-19 17:14:41 +00:00
christos 83bcb34124 save and restore the tty settings on entry and exit respectively.
cleanup debugging printfs.
2012-05-15 15:59:01 +00:00
christos b6f308812d fixed warnings where wint_t is unsigned. 2011-10-04 15:27:04 +00:00
christos 3d802cf59d re-enable -Wconversion 2011-08-16 16:25:15 +00:00
christos 7ecb1ef25e kill ifdef notdef 2011-07-29 15:20:39 +00:00
christos b71bed95b3 KNF return (\1); -> return \1; 2011-07-29 15:16:33 +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 e63c844a17 term -> terminal 2011-07-28 00:45:50 +00:00
christos 28ef40ccbd fix pasto 2011-01-28 03:41:52 +00:00
christos b2ce31d086 don't turn on editing if stdout is not a tty. 2011-01-27 23:11:40 +00:00
christos df810c5405 ffs needs strings.h 2010-04-18 21:17:22 +00:00
christos 34e53048e6 Wide character support (UTF-8) from Johny Mattsson; currently disabled. 2009-12-30 22:37:40 +00:00
christos e304eddfd2 Don't depend on side effects inside an assert
From Michael Cook mcook at bbn dot com
2009-07-22 15:58:09 +00:00
christos 7939d24e16 fix sign compare issues. 2009-02-16 00:15:45 +00:00
christos 5c894153a3 pass lint on _LP64. 2009-02-15 21:55:23 +00:00
sketch 957effbd58 Needs errno.h 2009-02-06 19:53:23 +00:00
christos 872a7369cc Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects. Mostly from Preston A. Elder.
2008-09-10 15:45:37 +00:00
christos 365dab42f3 handle EINTR in the termios operations, reported by the GHC folks 2008-07-30 13:00:46 +00:00
christos 87113ce74b Coverity CID 597: remove dead code. 2006-03-18 09:09:41 +00:00
christos 78f7dbe212 Coverity CID 1216: Prevent negative index use. 2006-03-18 09:07:05 +00:00
lukem ac636bd17a Don't use non-standard uint or u_int. 2005-06-01 11:37:52 +00:00
christos 917b5f36b1 PR/25694: Luke Mewburn: Don't abuse unconstify'ing a string and writing to
it, because you'll core dump. Also remove extra const that gives pain to
the irix compiler.
2005-05-29 03:55:37 +00:00
mycroft 6360c4b0f8 Delete-previous-char and delete-next-char without an argument are not supposed
to modify the yank buffer in Emacs.  Make it so.
2004-08-13 12:10:38 +00:00
christos e7c6d717ff remove debugging printf. 2003-10-18 22:37:24 +00:00
christos 730f23e551 Allow setty to set chars using char=value 2003-10-18 22:24:34 +00:00