Commit Graph

292 Commits

Author SHA1 Message Date
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
tg c6edd7ebe6 lessons learned during nullperf tests: inlining this is always bad 2012-07-01 15:36:18 +00:00
tg 29e36ed2a2 move x_mkraw() to main.c from edit.c in order to be able to skip the latter 2012-05-05 17:32:33 +00:00
tg e6ace01f12 last parts of Coherent patchkit: O_ACCMODE and termio 2012-05-04 22:18:27 +00:00
tg 5780bc5eb7 new MKSH_NO_CMDLINE_EDITING to disable command line editing in its entirety
mainly for the Plan 9 port though it may also help the WinAPI variant,
other porting efforts, as well as a new project I cannot say yet
2012-05-04 20:49:08 +00:00
tg 8ac32ba793 fix some comments 2012-04-06 15:06:42 +00:00
tg 2a833165a0 add xep bounds check in x_goto, maybe this will fix the problem the Motorola guys are havink 2012-03-31 19:52:34 +00:00
tg bb1c1e7dba a few more int → bool 2012-03-31 19:20:12 +00:00
tg 86c4ea4619 add (#ifdef DEBUG) an assertion that xcp <= xep before doing an Emacs mode
command; DONG-DONG YANG reports they hit this condition
2012-03-31 17:29:04 +00:00
tg 21c15c0b8f huh, I thought I had extended ${parameter@#hash} already; make it so now,
but not yet things like ${parameter@Fi} (1 if integer, 0 otherwise), etc.
also bump patchlevel and © years in recently changed files
2012-03-23 23:25:30 +00:00
tg 69e1312265 fix real-life example From: Andrew Kudryashov <andrewinsilenthill@gmail.com>
in <CABNd6wz3SSRWamUNQ-BNcp7z0pthOR156=Zy3qBYmXhTjvoYsg@mail.gmail.com> but
by a different (cheaper) method than the one in his patch from message-id
<CABNd6ww7zFUQ4Ho2zQQzQyERy==8Hqg_y12Acmj1sF6ka4b4KQ@mail.gmail.com>:

when completing, always replace the olen text with the new one, and only
then take the length of the x_expand()ed nlen text to compare and check
whether to set completed=true; this also means:

$ ls foo\+/<tab>
          ↓
$ ls foo+/

this matches reality even better and saves us a couple of string traversals
2012-03-23 21:34:47 +00:00
tg 8e2d84f455 address <CABNd6wz3SSRWamUNQ-BNcp7z0pthOR156=Zy3qBYmXhTjvoYsg@mail.gmail.com>
From: Andrew Kudryashov <andrewinsilenthill@gmail.com>

Hunk 1: “Also, I found that x_escape() does funny things to sequences
of backslashes” which was caused by improper quoting; use an empirical
list of chars to escape (only 0x20‥0x7E, everything else is SOL anyway)

Hunk 2: “and "\*" will be appended” was actually correct, but not in
all cases; handle these cases (and break 0x02 in filename)
2012-03-23 21:15:34 +00:00
tg bee3bbaaf8 reduce stack usage a bit (several candidates for more, including $CC itself…) 2012-01-29 01:41:15 +00:00
tg bb51eee63c when doing tab completion partial inserts in UTFMODE, honour multibyte character boundaries (LP: #909025) 2011-12-29 23:36:10 +00:00
tg 4748739523 eek, mira, don’t leave debugging code lying around 2011-12-11 18:07:45 +00:00
tg 986d999e58 make ^O work like it did before we introduced x_modified(), that is,
editing the refetched input line doesn’t let it restart (but ^R does)
2011-12-11 18:01:03 +00:00
tg 44d072a879 beautify a Vi function (no code change), from tech@ discussion 2011-12-04 23:22:59 +00:00
tg 23afb6dbb8 merge “upper bound Emacs mode command repeat by input line length” from
oksh (slightly different implementation) and remark better plans (which
doesn’t mean bounding the repeat counter is bad, though…)
2011-10-07 19:45:08 +00:00
tg 9782f6b4d1 • access(2) is broken in at least kFreeBSD 9.0 as “modern” OS, so bring
back the wrapper code as well as refactor most other code calling it
• apparently, names can’t end in ‘_’ or contain ‘__’ anywhere…
2011-09-07 15:24:22 +00:00