summaryrefslogtreecommitdiffhomepage
path: root/DESIGN.md
diff options
context:
space:
mode:
Diffstat (limited to 'DESIGN.md')
-rw-r--r--DESIGN.md43
1 files changed, 18 insertions, 25 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