Commit Graph

310 Commits

Author SHA1 Message Date
tg 5613d6a04a an edchar cannot conceivably be NUL, so set them to the default;
this is confirmed to help fix OS/2 and plugs an uninitialised read
on systems without werase
2015-07-10 17:31:09 +00:00
tg e0196f47d5 implement completely new multiline code by delaying history store
this commit is valgrind-tested
2015-07-05 19:37:18 +00:00
tg d3331c04d4 add binding for another well-known ANSI Del key
From: Ivan Delalande <colona@ycc.fr>
2015-05-03 11:28:53 +00:00
tg 609b311919 more low-hanging fruits for EBCDIC; notes:
• ord() new, From: Daniel Richard G. <skunk@iSKUNK.ORG>
  ‣ used in some places
• (c - '0') → ksh_numdig(c)	# may take *x++ argument
• (c - 'A') → ksh_numuc(c)	# may NOT take *x+= argument
  ‣ idem for ksh_numlc(c) and 'a'
  ‣ these need changing for EBCDIC
  ‣ add testsuite for this
• use macros more, they exist already often
• use digits_lc[foo] instead of ('0' + foo), especially for letters
• caught another ksh_eq case…
• also caught a maybe-UB overflow check, but we don’t have TIME_T_MAX ☹
2015-04-29 20:07:35 +00:00
tg 6b00977053 just another oksh rcsid-only sync (we bind to the Delete key since forever) 2015-04-11 22:09:49 +00:00
tg 532af35304 oksh rcsid sync; we have no set -o csh-history, and the manpage changes are just wrong, so, a nop 2015-03-14 05:17:17 +00:00
tg 61cea6b71b another oksh rcsid-only sync 2015-02-16 15:10:15 +00:00
tg 643bbe7c60 no need for this explicit one, emacsfn.h already defines them 2014-11-25 22:38:53 +00:00
tg 2f52b993a1 • Build.sh: fix NSIG detection for gcc-snapshot
• all: bump version to R50-current; add more comments; whitespace
• all: remove all mkssert(); we’ll do full re-runs of scan-build and,
  hopefully, Coverity Scan/Prevent
• check.t: fix a testcase (sed could exit false, but we don’t care)
• eval.c: fix tilde_ok data type (only unsigned may shl constantly)
• exec.c: fix shebang buf array accesses to always go via uint8_t *
2014-11-25 21:13:31 +00:00
tg 0d9b36daa3 prototype for a static function used before it’s defined
XXX add protos for all static functions (just: hard to find them)
2014-11-19 21:52:16 +00:00
tg 517bd63fe5 rename the “tilde” function; apparently, some system headers define it 2014-11-19 21:49:12 +00:00
tg 0432fc1a87 Get rid of left over NULL elements in x_ftab as NELEM() is used instead.
From Martin Natano. Also get rid of related checks.
2014-11-14 20:00:40 +00:00
tg 0eb5044ac6 fix rare infinite loop when invalid UTF-8 is in the edit buffer
From: Ivan “Colona” Delalande <colona@ycc.fr>
2014-07-13 11:34:29 +00:00
tg 89e774fd7e • fix ${12345678901234567890} segfault (OOB access / integer overflow)
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
2014-01-05 21:57:29 +00:00
tg 2f7eec765d merge oksh’s “ctype cleanups” commit
(not much of it applies since we don’t use the OS’ table-based lookup)
2014-01-05 19:11:46 +00:00
tg c4c4fd7365 RCSID-only oksh sync (their whitespace changes don’t apply to us)
note that emacs.c partial peereboom rewrite is *not* merged, and kept that way
2013-11-30 17:33:51 +00:00
tg 7f16464902 slightly optimised and, more importantly, much more consistent (use only
one set of CTRL, UNCTRL, and new ISCTRL macros) C0 and DEL handling; the
optimisation only works for 7-bit ASCII, so those places 8-bit must pass
intact have an added check

also, while here, remove an editor oops (‘;’), oksh rcsid sync (they did
accept I was right wrt. set -e), int → bool, and code merge/cleanup
2013-09-24 20:19:45 +00:00
tg 5eb6995d75 Ypnose discovered a problem with multi-line prompts and SIGWINCH
related to caching some values (downside, pprompt gets back doprint option)
2013-08-16 10:59:03 +00:00
tg bf94b7e2ec fun: when writing this code I feared an off-by-one;
Steffen Daode Nurpmeso stumbled upon it and gave very detailed
instructions on how to reproduce it (thanks!); fix that

also only call x_bs0 if xcp < xep because *xep is undefined
2013-08-14 20:26:19 +00:00
tg c10e5bd237 reduce amount of .bss memory needed; initialise via AEDIT at x_init
or even first run of x_vi
2013-08-10 13:44:33 +00:00
tg 247e20c524 • Completely overhaul prompt length calculation and
prompt display routines; make Emacs and Vi share
  code, permitting reducing of duplication and code
  removal as well as more consistent behaviour; put
  some common code into shared helper functions, too
• New x_adjust() logic (Emacs mode): when determining
  what portion of a line to render use a much more
  sophisticated algorithm and try to fill up ⅔ of the
  total screen width (with line and prompt both) also
  as wished from Steffen Daode Nurpmeso
2013-07-26 20:33:39 +00:00
tg 4e1196239a RCSID sync with oksh (fixed by us 4 years ago already) 2013-06-03 22:27:42 +00:00
tg f2906c79df for Yofuh: implement Emacs mode PgUp as Vi insert mode CurUp 2013-05-02 15:33:30 +00:00
tg 2b06709bf3 improve DEBUG_LEAKS handling and fix freeing some locs 2013-02-10 19:05:37 +00:00
tg 59009ac78f call it DEBUG_LEAKS so Android can always enable it 2013-02-10 17:41:06 +00:00
tg 63b6d920a8 actually, only needed #ifdef DEBUG 2013-02-10 17:39:38 +00:00
tg cb93db360d call afreeall(AEDIT) upon close; related to LP#1106116 2013-02-10 17:38:15 +00:00
tg 1da94d6159 pure RCSID sync with oksh, who also added a tabcompletion fix now, with
less code, but, even according to their own comments, not as good as ours
2013-02-10 17:18:49 +00:00
tg b2396677e7 harmonise sys_{sig,err}list ⓐ checks, ⓑ uses, ⓒ _decl values when not needed, ⓓ prototypes; ⓔ “const” is a keyword and thus space-separated from the preceding ‘*’ pointer indicator 2012-12-28 02:28:39 +00:00
tg 0780070d24 add a few assertions for LLVM+Clang 3.2 scan-build; no !DEBUG changes 2012-12-08 18:30:31 +00:00
tg cf807eb83a Add assertions and shuffle code around for LLVM+Clang scan-build. 2012-12-04 01:18:34 +00:00
tg b868c517b7 remove *all* nonnull assertions and other workarounds for clang scan-build
this beast evolved in the last 2½ years, and we’ve had trouble with
some of them earlier
2012-12-01 01:36:30 +00:00
tg b58d7b8053 fix regression wrt. pdksh (introduced between R40e and R40f)
about how and when the display is redrawn by reverting one
bool back to an int, as it’s used as a counter (hm, should
be an unsigned I guess but…)

on the other hand, xlp_valid should’ve been a bool, make it so
2012-11-26 22:39:14 +00:00
tg 1f43cc907d fix backslash-asterisk glob noise for nōn-existant targets and tilde
expansion completion; problem analysis and solution draft by Andrew
Kudryashov (thanks a lot!); this fix instead re-uses existing code
for solving the problem with multiple matches

debugged using “make d dr” targets, yay!
2012-10-21 18:33:46 +00:00
tg d8662eb228 even more hacks to pass “-O666 -fstrict-overflow -Wstrict-overflow=9 -flto=jobserver” with “gcc version 4.8.0 20120930 (experimental) [trunk revision 191865] (Debian 20120930-1)” ☹ plus make the rtchecks mandatory 2012-10-03 17:24:23 +00:00
tg 0575d07671 rewrite XPtrV to use size_t instead of pointer arithmetic, for gcc-snapshot (20120930-1) -fstrict-overflow -Wstrict-overflow=9 2012-10-03 15:50:32 +00:00
tg 9fbdef8e60 pure RCSID sync with OpenBSD, as we introduced SIGWINCH tracking earlier
XXX we could track whether tty_fd has already been successfully opened,
XXX the ttystate initialised, and then just never close it unless it is
XXX necessary, then we can keep COLUMNS/LINES accurate in scripts, even
2012-09-21 17:20:22 +00:00
tg e6ddeaa53d sync clog 2012-08-24 21:33:51 +00:00
tg e2d1f3bf99 related to LP#1025843 fix tab completion for tilde
this code is insane, who wrote globbing and expansion for mksh’s
predecessor must have been on very interesting drugs
2012-08-24 21:15:42 +00:00
tg 42ac0dc08e second attempt at getting '$FOO/b*r/baz' tab-completed right,
plus the beginning of the tilde fix… do not use, this is fucking
impossible to get right, but I’d like an archival commit
2012-08-24 20:57:46 +00:00
tg 2ed6e8998c repair globbing $foo/ba*r/baz 2012-08-24 20:05:13 +00:00
tg 829cd0cc70 leak less memory from tab completion 2012-08-24 19:14:56 +00:00
tg beca8ed86f more int → bool 2012-08-24 19:02:57 +00:00
tg 403c7c8e50 remove misleading comment fixed in last commit 2012-07-20 22:47:22 +00:00
tg b90a11f6c5 fix more cases of x_delete() bytes vs. characters abuse (tested!); fix some int vs. size_t issues (XXX also fix x_cf_glob and friends some day…) 2012-07-20 20:50:07 +00:00
tg bea2b756b3 factor out common code (convert from "byte offset from cursor" to number of characters) 2012-07-20 20:33:15 +00:00
tg 98ff25a001 fix no less than two more bugs and one regression in the Emacs tab completion code (LP#1025843) 2012-07-20 20:16:26 +00:00
tg 2aceb6893d make QCHAR-for-glob {,un}escaping code into helper functions
no code change
2012-07-20 18:39:53 +00:00
tg 1e2755edc1 x_lastcp(); done by x_zots already 2012-07-20 18:08:23 +00:00
tg 4778a2a62f lesson learned from http://k1024.org/~iusty/blog/entry/perf-null/ – add -DMKSH_SMALL_BUT_FAST which gives more speed (8/20K less cycles, 5/9K less insns, 1.8/2.4k less branches, 65/275 less branch misses) on Debian/amd64 (klibc-static/eglibc) at cost of 0/2 more page faults and 6K/6K more text size 2012-07-01 15:55:00 +00:00