summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--DESIGN.md43
-rw-r--r--Doxyfile11
-rw-r--r--Makefile7
-rw-r--r--README.md9
-rw-r--r--bench/README.md31
-rw-r--r--bench/editor.py2
-rw-r--r--src/edit_builtin.c5
-rw-r--r--src/edit_libedit.c293
-rw-r--r--src/interact.h10
-rw-r--r--src/main.c4
-rw-r--r--tests/linux/i-bind.sh6
-rw-r--r--tests/linux/i-dscomplete.sh6
-rw-r--r--tests/linux/i-emacs.sh6
-rw-r--r--tests/linux/i-history.sh6
-rw-r--r--tests/linux/i-prompt-esc.sh6
-rw-r--r--tests/linux/i-prompt.sh6
-rw-r--r--tests/linux/i-vi.sh6
-rw-r--r--tests/tools/ptydrive.py5
-rw-r--r--web/content/docs/install.md5
-rw-r--r--web/content/docs/status.md2
20 files changed, 51 insertions, 418 deletions
diff --git a/DESIGN.md b/DESIGN.md
index ea13ea6..e47e8c1 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -138,7 +138,6 @@ One directory, one module per file, each with a narrow header.
| `interact.c`, `interact.h` | prompts and reading lines from a terminal |
| `history.c` | history list, `HISTFILE`, `fc` |
| `edit_builtin.c` | the built-in line editor (emacs and vi modes) |
-| `edit_libedit.c` | the same interface on top of libedit (optional) |
| `complete.c` | completion candidates for the built-in editor |
| `sys_posix.c`, `sys_zos.c`, `sys.h` | the only platform-specific code |
| `main.c` | startup, options, exit |
@@ -940,30 +939,24 @@ interactive shell?"
has insert and command modes with counts, the common motions, `d c y`
with motions, `x X r ~ D C S p P u`, history with `k j G / ? n N`.
UTF-8 is handled as far as single-width characters.
-- Prompt width (`esc_seq_len()` in `interact.c`, shared with the libedit
- build). A prompt is measured by skipping the sequences a terminal
- understands, so that colour and titles take no columns. That is more
- than CSI: an OSC title or hyperlink runs to BEL or `ESC \`, DCS runs
- the same way, and `tput sgr0` is the three-byte `ESC ( B` before
- `ESC [ m`, so a prompt built with `$(tput ...)` is measured right.
-- libedit (`edit_libedit.c`) implements the same two functions:
- `make EDIT=libedit LDLIBS=-ledit`. The shell's own history list stays
- authoritative and is copied into libedit before each line. Control
- sequences in the prompt are bracketed for `EL_PROMPT_ESC` so that
- colour does not count as columns. A prompt that ends with such a
- sequence gains a space: libedit attaches a literal run to the character
- after it and would otherwise drop the last one.
-- Completion is one implementation for both editors (`complete_line()`,
- `complete_escaped()` and `complete_listing()` in `complete.c`), so a
- candidate is escaped, finished and listed the same way whichever editor
- is on: libedit's Tab is bound to a function that calls it and asks for a
- full redraw, since a completion replaces the middle of the line.
-- `$ZASH_EDITOR` says which one is compiled in (`builtin` or `libedit`).
- Keys and redraw are the editor's own — libedit reads `~/.editrc`, draws
- a prompt that starts with an OSC title with one space too many, and
- echoes `^D` on an empty line rather than printing nothing — so the
- interactive tests that encode the built-in editor's bindings and drawing
- skip under libedit. `tests/linux/i-complete` covers what both share.
+- Prompt width (`esc_seq_len()` in `interact.c`). A prompt is measured by
+ skipping the sequences a terminal understands, so that colour and
+ titles take no columns. That is more than CSI: an OSC title or
+ hyperlink runs to BEL or `ESC \`, DCS runs the same way, and
+ `tput sgr0` is the three-byte `ESC ( B` before `ESC [ m`, so a prompt
+ built with `$(tput ...)` is measured right.
+- One editor, linked in, no library. libedit was a compile-time
+ alternative (`make EDIT=libedit`) and was dropped: FreeBSD and NetBSD
+ `sh` use it because it is in their base system, which is not the case
+ on z/OS, and it cost about a third of a millisecond at start (three
+ more shared libraries, `el_init()`, an `~/.editrc` read, a copy of the
+ history) against the same cost per key. `bench/README.md` has the
+ measurement. What it bought was `~/.editrc` bindings and a kill ring,
+ which `bind` and the built-in editor's own bindings cover.
+- Completion is split by what it needs. `complete.c` finds candidates,
+ escapes them (`complete_escaped()`) and lays out a listing
+ (`complete_listing()`); the editor decides where the word starts and
+ redraws, since a completion replaces the middle of the line.
- Completion (`complete.c`) covers variables after `$`, aliases,
functions, builtins and `PATH` programs in command position, and files
elsewhere, with `/` after a directory. Completed text is
diff --git a/Doxyfile b/Doxyfile
index 963e7e8..f386259 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -22,10 +22,9 @@ GENERATE_TREEVIEW = YES
WARN_LOGFILE = docs/doxygen-warnings.txt
WARN_IF_UNDOCUMENTED = YES
WARN_NO_PARAMDOC = NO
-# Two files are alternative implementations of the same interface and
-# would be documented twice over: edit_libedit.c (the editor, when libedit
-# is used) and sys_posix.c (the platform layer on Linux). Their contract
-# is in interact.h and sys.h; the files documented here are the ones with
-# the explanations, edit_builtin.c and sys_zos.c.
-EXCLUDE = src/edit_libedit.c src/sys_posix.c
+# Two files are alternative implementations of one interface and would be
+# documented twice over: sys_posix.c (the platform layer on Linux) against
+# sys_zos.c. Their contract is in sys.h; the file documented here is the
+# one with the explanations.
+EXCLUDE = src/sys_posix.c
PREDEFINED = PRINTFLIKE(f,a)= NODISCARD= _Noreturn=
diff --git a/Makefile b/Makefile
index 9e4d912..bbf8c44 100644
--- a/Makefile
+++ b/Makefile
@@ -77,8 +77,6 @@ ZCPPFLAGS = -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L -D_ALL_SOURCE \
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
-# The line editor: "builtin" (no dependencies) or "libedit"
-# (make EDIT=libedit LDLIBS=-ledit).
CLANG_FORMAT = clang-format
CLANG_TIDY = clang-tidy
@@ -96,7 +94,6 @@ DUMP =
AMBLIST_STMT = LISTLOAD OUTPUT=BOTH
-EDIT = builtin
LDLIBS =
HDRS = src/ast.h src/charset.h src/exec.h src/expand.h src/interact.h src/mvsfmt.h \
@@ -105,12 +102,12 @@ COMMON = src/alias.c src/arith.c src/builtin.c src/builtin_ext.c \
src/complete.c src/cond.c src/exec.c src/expand.c src/history.c src/input.c \
src/interact.c src/jobs.c src/main.c src/mvsfmt.c src/parser.c src/pattern.c \
src/printf.c src/redir.c src/test.c src/trap.c src/unparse.c \
- src/util.c src/var.c src/edit_$(EDIT).c
+ src/util.c src/var.c src/edit_builtin.c
OBJS = src/alias.o src/arith.o src/builtin.o src/builtin_ext.o \
src/complete.o src/cond.o src/exec.o src/expand.o src/history.o src/input.o \
src/interact.o src/jobs.o src/main.o src/mvsfmt.o src/parser.o src/pattern.o \
src/printf.o src/redir.o src/test.o src/trap.o src/unparse.o \
- src/util.o src/var.o src/edit_$(EDIT).o src/sys_$(SYS).o
+ src/util.o src/var.o src/edit_builtin.o src/sys_$(SYS).o
# z/OS builds zash with IBM Open XL (ibm-clang, not clang) and without
# posix_spawn, so plain `make` builds the ASCII z/OS build there. z/OS make
diff --git a/README.md b/README.md
index 64f5599..d66d126 100644
--- a/README.md
+++ b/README.md
@@ -58,9 +58,9 @@ It aims to be the dash of z/OS, but more usable interactively.
3. Interactive comfort that is free for scripts: job control, tab
completion for files and commands, history, emacs- and vi-style
editing. The keys are bash's, and `bind '^[[H'=beginning-of-line`
- moves one in the BSD shells' notation. A built-in editor is the
- default and libedit is a compile-time alternative. Neither is
- initialised by a non-interactive shell.
+ moves one in the BSD shells' notation. The editor is built in, with
+ no terminfo or curses dependency, and a non-interactive shell never
+ initialises it.
4. The Korn shell features z/OS scripts actually use: `print`,
`whence`, `typeset`, `function name { }`, `(( ))`, `let`, aliases.
They are accepted only where they cost other scripts nothing.
@@ -109,7 +109,6 @@ version. That stays the reference, and it is what Linux builds use.
```sh
make # Linux, clang, -std=c23
make zash # Linux: the same build, named exactly
-make EDIT=libedit LDLIBS=-ledit # use libedit, not the built-in editor
make check # run the test suite
make asan # build zash-asan (ASan + UBSan) and run the tests
make valgrind # run the tests under Valgrind
@@ -207,7 +206,7 @@ code in one small file. That is what makes the Linux tooling useful.
On Linux the shell is feature-complete for its first release: the
scripting core, the FreeBSD and Korn extensions, job control, and the
interactive layer (built-in editor with emacs and vi modes, completion,
-history and `fc`, libedit optional). It builds warning-free with Clang as
+history and `fc`). It builds warning-free with Clang as
C23 and passes its suite plain, under ASan/UBSan, and under Valgrind.
On z/OS it builds in both character modes with Open XL, 64-bit, passes
diff --git a/bench/README.md b/bench/README.md
index 9621ba3..128748c 100644
--- a/bench/README.md
+++ b/bench/README.md
@@ -363,37 +363,38 @@ has no sub-second format. `BENCH_N` sets the number of starts, and
## The line editor
-`EDIT=libedit` replaces the built-in editor with libedit, and the two
-costs it changes are both in the interactive path, which `run.sh` and
-`startup.sh` do not touch. `editor.py` measures them on a
+The editor is built in, and `editor.py` is what made that decision easy.
+It measures the two costs the off-the-shelf editor changed, both in the
+interactive path that `run.sh` and `startup.sh` do not touch, on a
pseudo-terminal: `BENCH_N` starts, each timed from just before the fork
to the first byte of the prompt, then `BENCH_KEYS` keys typed one at a
time, each timed from the write to its echo.
```sh
-make EDIT=libedit LDLIBS=-ledit # writes ./zash, keep a copy
-cp zash zash-libedit && make zash # the built-in one
-python3 bench/editor.py ./zash ./zash-libedit
+python3 bench/editor.py ./zash dash bash # any shells, it types at each
```
-Linux, both `-O3`, 20 and then 50 starts, keys medians of 200:
+Linux, `-O3`, 20 and then 50 starts, keys medians of 200:
| editor | start | one key |
| --- | --- | --- |
| built-in | 0.94-1.02 ms | 7.2-8.5 us |
| libedit | 1.20-1.27 ms | 7.2-7.4 us |
-libedit pays about a third of a millisecond more to get to the prompt:
-three more shared libraries to load (libedit, ncurses, and the terminfo
-entry it reads), `el_init()`, an `~/.editrc` attempt, and the copy of
-the shell's history into libedit. Every key costs the same either way;
-the round trip is the terminal driver and the scheduler, and the editor's
-own work on a key is too small to see through that.
+libedit, which zash could be built against (`make EDIT=libedit`) until it
+was dropped, paid about a third of a millisecond more to get to the
+prompt: three more shared libraries to load (libedit, ncurses, and the
+terminfo entry it reads), `el_init()`, an `~/.editrc` attempt, and the
+copy of the shell's history into libedit. Every key costs the same either
+way; the round trip is the terminal driver and the scheduler, and the
+editor's own work on a key is too small to see through that.
-So the built-in editor wins a start that never edits, which is the case
+So the built-in editor wins the start that never edits, which is the case
`make check` and a `#!` line are; for a session spent typing, the two are
the same. Neither forks or execs per key, which is the cost that would
-have mattered.
+have mattered. DESIGN.md records the rest of the reason: FreeBSD and
+NetBSD `sh` use libedit because it is in their base system, and z/OS has
+no such thing.
## Address mode: 64-bit now
diff --git a/bench/editor.py b/bench/editor.py
index 6e99cdf..e6d3240 100644
--- a/bench/editor.py
+++ b/bench/editor.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""What the line editor costs: start to first prompt, then one key.
- bench/editor.py ./zash ./zash-libedit [more shells ...]
+ bench/editor.py ./zash dash bash [more shells ...]
Each shell is started BENCH_N times (default 20) on a pseudo-terminal, the
wall clock is read from just before the fork to the first byte of the
diff --git a/src/edit_builtin.c b/src/edit_builtin.c
index 2a2652c..14ad8ac 100644
--- a/src/edit_builtin.c
+++ b/src/edit_builtin.c
@@ -30,9 +30,6 @@
* The terminal is put in a mode where it still generates signals, so
* `^C` arrives as SIGINT and interrupts the read. The editor then gives
* the terminal back and lets trap_poll() abandon the line.
- *
- * The alternative editor, edit_libedit.c, implements the same two
- * functions with libedit. The makefile links exactly one of them.
*/
#include <ctype.h>
#include <errno.h>
@@ -100,8 +97,6 @@ typedef struct editor {
*/
static editor ed;
-const char edit_name[] = "builtin";
-
/* ---- terminal -------------------------------------------------------- */
/**
diff --git a/src/edit_libedit.c b/src/edit_libedit.c
deleted file mode 100644
index b6cdcd3..0000000
--- a/src/edit_libedit.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/**
- * @file edit_libedit.c
- * @brief The line editor implemented with libedit (BSD editline).
- *
- * This is the compile-time alternative to edit_builtin.c:
- *
- * make EDIT=libedit LDLIBS=-ledit
- *
- * It provides the same two functions, edit_usable() and edit_readline(),
- * so nothing else in the shell knows which editor is linked. libedit
- * brings its own key bindings (including a fuller vi mode) and reads
- * `~/.editrc`. It also brings a dependency on the library and on
- * terminfo or termcap, which is why it is not the default.
- *
- * The shell's own history list (history.c) stays the single source of
- * truth, because `fc` works on it. Before each line is read the list is
- * copied into libedit's history so that the arrow keys and searches see
- * the same entries.
- *
- * A prompt is written by libedit and counted as it is written, so the
- * colour sequences of PS1 would be counted as visible columns and the
- * cursor would land to the right of where it belongs. Libedit is told
- * the ignore character (EL_PROMPT_ESC) and every control sequence is
- * bracketed with it, which prints the sequence but does not count it.
- */
-#include <errno.h>
-#include <histedit.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "charset.h"
-#include "exec.h"
-#include "interact.h"
-#include "shell.h"
-
-/** @brief The character that brackets a run libedit must not count. */
-enum { PROMPT_MARK = '\1' };
-
-const char edit_name[] = "libedit";
-
-/**
- * @brief The libedit editor, created on first use.
- */
-static EditLine *el;
-/**
- * @brief libedit's copy of the history.
- */
-static History *el_hist;
-/**
- * @brief The prompt for the line being read, marked for libedit.
- */
-static char *cur_prompt;
-
-/**
- * @brief End of the run of control sequences that starts at s.
- *
- * Adjacent sequences share one mark pair: libedit attaches the run to
- * the character after the closing mark, and that character has to be a
- * printable one.
- *
- * @param s Text starting with CH_ESC.
- * @return The first byte after the run.
- */
-static const char *ctl_run_end(const char *s) {
- do
- s += esc_seq_len(s);
- while (*s == CH_ESC);
- return s;
-}
-
-/**
- * @brief Bracket the parts of a prompt that take no room on the screen.
- *
- * libedit counts every character of the prompt as a column unless it is
- * marked. Its literal run is attached to the character after the closing
- * mark, whose width is the run's width, so a prompt that ends with a
- * control sequence gets a space from here to be that character: libedit
- * would drop the run otherwise (prompt.c: "We lose the last literal"),
- * and counting the sequence instead would put the cursor out by its
- * length. The extra space is visible and is counted, so the line still
- * starts where libedit thinks it does.
- *
- * @param s The prompt.
- * @return The prompt with its control sequences marked, for free().
- */
-static char *prompt_marked(const char *s) {
- size_t n = strlen(s);
- const char *last = nullptr;
- for (const char *p = s; *p;) {
- if (*p != CH_ESC) {
- p++;
- continue;
- }
- n += 2;
- last = ctl_run_end(p);
- p = last;
- }
- bool trailing = last && !*last;
- char *out = xmalloc(n + (trailing ? 2 : 1));
- char *o = out;
- for (const char *p = s; *p;) {
- if (*p != CH_ESC) {
- *o++ = *p++;
- continue;
- }
- const char *e = ctl_run_end(p);
- *o++ = PROMPT_MARK;
- memcpy(o, p, (size_t)(e - p));
- o += e - p;
- *o++ = PROMPT_MARK;
- p = e;
- }
- if (trailing)
- *o++ = ' ';
- *o = '\0';
- return out;
-}
-
-/**
- * @brief zash's completion, bound to Tab.
- *
- * libedit hands the whole line and cursor to an editing function, so the
- * work is the same as the built-in editor's: one candidate is inserted
- * whole (with the quoting it needs) and the word finished with a space
- * unless it is a directory; several are completed as far as they agree,
- * and listed when that adds nothing. The listing comes from complete.c,
- * so both editors print the same block.
- *
- * @param e The editor.
- * @param ch The key, unused.
- * @return CC_REFRESH so libedit redraws the line.
- */
-static unsigned char complete_cb(EditLine *e, int ch) {
- (void)ch;
- const LineInfo *li = el_line(e);
- if (!li)
- return CC_ERROR;
- size_t cursor = (size_t)(li->cursor - li->buffer);
- completion c;
- complete_line(li->buffer, cursor, &c);
- if (!c.count) {
- complete_free(&c);
- return CC_REDISPLAY;
- }
- size_t common = strlen(c.list[0]);
- for (int i = 1; i < c.count; i++) {
- size_t k = 0;
- while (k < common && c.list[i][k] == c.list[0][k])
- k++;
- common = k;
- }
- /* The typed word without its backslashes, to know whether the
- * candidates would make it longer. */
- size_t typed = 0;
- for (size_t i = c.start; i < cursor; i++) {
- if (li->buffer[i] == '\\' && !c.quoted && i + 1 < cursor)
- i++;
- typed++;
- }
- if (c.count == 1 || common > typed) {
- el_deletestr(e, (int)(cursor - c.start));
- char *text = complete_escaped(c.list[0], common, c.quoted);
- el_insertstr(e, text);
- free(text);
- char last = c.list[0][common - 1];
- bool final = last != '/' && !(c.mvs && (last == '.' || last == '('));
- if (c.count == 1 && final) {
- if (c.quote) {
- char q[2] = {c.quote, '\0'};
- el_insertstr(e, q);
- }
- el_insertstr(e, " ");
- }
- } else {
- char *listing = complete_listing(&c, term_cols(), term_rows());
- fputs(listing, stderr);
- free(listing);
- }
- complete_free(&c);
- /* The whole line, not just the part that changed: what a completion
- * replaces is in the middle of it, and a redraw of the tail alone
- * leaves the reader's terminal showing a different line from the one
- * the shell has. */
- return CC_REDISPLAY;
-}
-
-/**
- * @brief Choose the editing mode and (re)install the completion key.
- *
- * libedit replaces the key map when the editor is selected, which drops
- * bindings made before, so the two go together and only when the mode
- * changes.
- *
- * @param vi true for vi bindings, false for emacs.
- */
-static void set_mode(bool vi) {
- static bool done;
- static bool is_vi;
- if (done && is_vi == vi)
- return;
- el_set(el, EL_EDITOR, vi ? "vi" : "emacs");
- el_set(el, EL_ADDFN, "zash-complete",
- "Complete the word before the cursor", complete_cb);
- el_set(el, EL_BIND, "^I", "zash-complete", nullptr);
- done = true;
- is_vi = vi;
-}
-
-/**
- * @brief libedit callback: the prompt for the line being read.
- * @param e Unused.
- * @return The prompt set by edit_readline().
- */
-static char *prompt_cb(EditLine *e) {
- (void)e;
- return cur_prompt ? cur_prompt : "";
-}
-
-/**
- * @brief Can lines be edited on this terminal?
- * @return true if stdin and stderr are terminals and TERM is not "dumb".
- */
-bool edit_usable(void) {
- const char *term = var_get("TERM");
- if (!term || !*term || !strcmp(term, "dumb"))
- return false;
- return isatty(0) && isatty(2);
-}
-
-/**
- * @brief Read one line with editing.
- *
- * @param prompt Text to show before the line.
- * @param len Receives the length of the line.
- * @return The line without its newline, valid until the next call;
- * nullptr at end of input.
- */
-char *edit_readline(const char *prompt, size_t *len) {
- static char *line;
- HistEvent ev;
- if (!el) {
- el = el_init("zash", stdin, stderr, stderr);
- el_hist = history_init();
- if (!el || !el_hist)
- return nullptr;
- history(el_hist, &ev, H_SETSIZE, 100000);
- el_set(el, EL_HIST, history, el_hist);
- el_set(el, EL_PROMPT_ESC, prompt_cb, PROMPT_MARK);
- el_set(el, EL_SIGNAL, 0);
- /* Before el_source(), so that ~/.editrc may bind Tab to
- * something else. */
- set_mode(opt.vi);
- el_source(el, nullptr);
- }
- set_mode(opt.vi);
- history(el_hist, &ev, H_CLEAR);
- for (int i = 0; i < hist_count(); i++)
- history(el_hist, &ev, H_ENTER, hist_entry(i));
-
- free(cur_prompt);
- cur_prompt = prompt_marked(prompt);
- for (;;) {
- int n = 0;
- const char *s = el_gets(el, &n);
- if (s && n > 0) {
- size_t k = (size_t)n;
- while (k && (s[k - 1] == '\n' || s[k - 1] == '\r'))
- k--;
- free(line);
- line = xmalloc(k + 1);
- memcpy(line, s, k);
- line[k] = '\0';
- *len = k;
- return line;
- }
- if (n < 0 && errno == EINTR) {
- trap_poll(); /* ^C abandons the line and does not return */
- continue;
- }
- return nullptr;
- }
-}
-
-int edit_bind(const char *spec) {
- sh_warn("bind: %s: this editor reads its bindings from ~/.editrc", spec);
- return -1;
-}
-
-void edit_bind_list(void) {
- sh_warn("bind: -l: this editor reads its bindings from ~/.editrc");
-}
diff --git a/src/interact.h b/src/interact.h
index 7894480..7a649c5 100644
--- a/src/interact.h
+++ b/src/interact.h
@@ -29,23 +29,15 @@ int hist_count(void);
const char *hist_entry(int index);
void hist_save(void);
-/* ---- the line editor (edit_builtin.c or edit_libedit.c) -------------- */
+/* ---- the line editor (edit_builtin.c) -------------------------------- */
/*
- * Both editors define these two functions, where they are documented.
* edit_usable() says whether lines can be edited on this terminal;
* edit_readline() reads one line and returns it without its newline, in
* storage it owns, or nullptr at end of input.
*/
bool edit_usable(void);
char *edit_readline(const char *prompt, size_t *len);
-/**
- * @brief Which editor is linked in: "builtin" or "libedit".
- *
- * It is the value of `$ZASH_EDITOR`, and the tests use it to skip what
- * only one of the two editors does.
- */
-extern const char edit_name[];
/*
* `bind`, in the notation of the BSD shells: edit_bind() records one
diff --git a/src/main.c b/src/main.c
index b4983be..43026f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -423,10 +423,6 @@ int main(int argc, char **argv) {
opt_login = true;
var_init(environ);
- /* Which line editor was linked in; the tests skip what only one of
- * the two does. Not exported: it describes this program, not the
- * environment a child should see. */
- var_set("ZASH_EDITOR", edit_name, 0);
/* POSIX: the shell sets and exports PWD even when the parent had none. */
char cwd[PATH_MAX];
if (!var_get("PWD") && getcwd(cwd, sizeof cwd))
diff --git a/tests/linux/i-bind.sh b/tests/linux/i-bind.sh
index 6681701..8bbc872 100644
--- a/tests/linux/i-bind.sh
+++ b/tests/linux/i-bind.sh
@@ -1,11 +1,5 @@
# Interactive: `bind`, the key bindings of the BSD shells.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
# -l lists what the editor can run
send bind -l | grep -c up-history\r
diff --git a/tests/linux/i-dscomplete.sh b/tests/linux/i-dscomplete.sh
index d8b6d7a..14d5d44 100644
--- a/tests/linux/i-dscomplete.sh
+++ b/tests/linux/i-dscomplete.sh
@@ -3,12 +3,6 @@
# that is turned into real CSI work areas, PDS directory blocks and TIOT
# entries, so this drives the same decoding the z/OS build uses.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
{
echo "X SYS1"
echo "SYS1.MACLIB"
diff --git a/tests/linux/i-emacs.sh b/tests/linux/i-emacs.sh
index b1d0eb4..465b583 100644
--- a/tests/linux/i-emacs.sh
+++ b/tests/linux/i-emacs.sh
@@ -1,11 +1,5 @@
# Interactive: the built-in editor in emacs mode.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
# insert in the middle: ^A, ^F
send echo one two\x01\x06\x06\x06\x06\x06X\r
diff --git a/tests/linux/i-history.sh b/tests/linux/i-history.sh
index 1e83d7b..4ac00d4 100644
--- a/tests/linux/i-history.sh
+++ b/tests/linux/i-history.sh
@@ -1,11 +1,5 @@
# Interactive: history, fc, ^R, HISTFILE.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
printf 'echo from-file\n' >hist
PS1='$ ' ENV='' HISTFILE=$PWD/hist HISTSIZE=50 \
python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
diff --git a/tests/linux/i-prompt-esc.sh b/tests/linux/i-prompt-esc.sh
index 0169663..18efd07 100644
--- a/tests/linux/i-prompt-esc.sh
+++ b/tests/linux/i-prompt-esc.sh
@@ -8,12 +8,6 @@
# counts the title and the `(B` as text, keeps 7 columns too few, and the
# redraw after ^A shows a shorter window than this expectation.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
python3 "$TESTS/tools/ptydrive.py" -c 16 "$TSH" <<'END'
send PS1='\\e]0;t\x07\\e(B\\e[1;32mP\\e[0m> '\r
expect P>
diff --git a/tests/linux/i-prompt.sh b/tests/linux/i-prompt.sh
index ffbd914..9a04f4f 100644
--- a/tests/linux/i-prompt.sh
+++ b/tests/linux/i-prompt.sh
@@ -1,11 +1,5 @@
# Interactive: prompts.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
mkdir here && cd here || exit 1
PS1='$ ' PS2='more> ' ENV='' HISTFILE='' HOME=$PWD \
python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
diff --git a/tests/linux/i-vi.sh b/tests/linux/i-vi.sh
index 4cb503f..7e1edaa 100644
--- a/tests/linux/i-vi.sh
+++ b/tests/linux/i-vi.sh
@@ -1,11 +1,5 @@
# Interactive: the built-in editor in vi mode.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" -o vi <<'END'
send echo hello world\x1b0wcwBYE\x1b\r
expect BYE world
diff --git a/tests/tools/ptydrive.py b/tests/tools/ptydrive.py
index ee1ebca..32503ee 100644
--- a/tests/tools/ptydrive.py
+++ b/tests/tools/ptydrive.py
@@ -90,9 +90,6 @@ def clean(data):
for ln in data.split(b"\n"):
parts = [p for p in ln.split(b"\r") if p]
lines.append(parts[-1] if parts else b"")
- data = b"\n".join(lines).replace(b"\x07", b"")
- # A NUL written to a terminal puts nothing on the screen; libedit emits
- # a run of them when it redraws a line after a completion.
- return data.replace(b"\x00", b"")
+ return b"\n".join(lines).replace(b"\x07", b"")
main()
diff --git a/web/content/docs/install.md b/web/content/docs/install.md
index 3b6d670..ffaeb08 100644
--- a/web/content/docs/install.md
+++ b/web/content/docs/install.md
@@ -24,9 +24,8 @@ make check # run the test suite against it
make install # copy it into $(DESTDIR)$(BINDIR)
```
-`EDIT=libedit LDLIBS=-ledit` builds against libedit instead of the built-in
-line editor. The default editor is compiled in and initialised only for an
-interactive shell.
+The line editor is compiled in, needs no library, and is initialised only
+for an interactive shell.
## z/OS
diff --git a/web/content/docs/status.md b/web/content/docs/status.md
index 2c3b247..78a9fd6 100644
--- a/web/content/docs/status.md
+++ b/web/content/docs/status.md
@@ -9,7 +9,7 @@ description: What works on Linux and on z/OS today, and what is still from docum
Feature-complete for a first release: the scripting core, the FreeBSD and Korn
extensions, job control, and the interactive layer (built-in editor with emacs
-and vi modes, completion, history, `fc`, libedit optional). It builds
+and vi modes, completion, history, `fc`). It builds
warning-free with Clang as C23 and passes its suite plain, under ASan/UBSan and
under Valgrind.