<feed xmlns='http://www.w3.org/2005/Atom'>
<title>zash.git/bench/editor.py, branch v0.5.0-beta</title>
<subtitle>Fast Almquist-family POSIX shell for z/OS UNIX with bundled libedit</subtitle>
<id>https://git.abendless.com/zash.git/atom?h=v0.5.0-beta</id>
<link rel='self' href='https://git.abendless.com/zash.git/atom?h=v0.5.0-beta'/>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/'/>
<updated>2026-11-26T03:54:08Z</updated>
<entry>
<title>interactive: one editor, no library</title>
<updated>2026-11-26T03:54:08Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-26T03:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=87c6a0f8f822c57b4f63bc8bb099a33307871414'/>
<id>urn:sha1:87c6a0f8f822c57b4f63bc8bb099a33307871414</id>
<content type='text'>
libedit was a compile-time alternative (`make EDIT=libedit`).  It goes:
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 to
reach the prompt -- three more shared libraries, `el_init()`, an
`~/.editrc` read and a copy of the history -- for the same cost per key.
What it bought was `~/.editrc` bindings and a kill ring; `bind` and the
built-in editor's own bindings cover the keys, and a second editor meant
a second build mode and a second set of interactive expectations, with
seven tests skipping under it.

Everything that existed only to serve two editors goes with it: the
`EDIT` switch and the two `edit_$(EDIT)` paths in the makefile, the
`$ZASH_EDITOR` variable the tests used to skip, the skip guards in
`tests/linux/`, the NUL stripping in `ptydrive.py` that libedit's redraw
needed, and the parallel paragraphs in README.md, DESIGN.md,
bench/README.md and the two website pages.  `bench/README.md` keeps the
measurement, since that is why the decision is written in DESIGN.md.

Checked on Linux (97 passed, 1 skipped, the one known local failure in
linux/i-dscomplete) and on z/OS (64 passed, 3 skipped, 0 failed, plus the
EBCDIC build).
</content>
</entry>
<entry>
<title>interactive: a prompt's width counts columns, not bytes</title>
<updated>2026-11-26T02:30:22Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-26T02:30:22Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=deb0ed011fe2cfc7058facb3f63b7feaeb8d4a8e'/>
<id>urn:sha1:deb0ed011fe2cfc7058facb3f63b7feaeb8d4a8e</id>
<content type='text'>
The built-in editor skipped `ESC [ ...` sequences when working out where
the prompt ends.  Colour and titles are not all 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`.  A prompt built with
`$(tput ...)` was measured wrong, which costs the cursor position and
with it the wrapped-line arithmetic.

`esc_seq_len()` in interact.c now walks what a terminal understands, and
edit_builtin.c uses it.  The libedit build shares the walk: it brackets
control runs for `EL_PROMPT_ESC`, and adds the space libedit needs when
a prompt ends in one, since libedit attaches a literal run to the
character after it.

bench/editor.py measures the two costs run.sh cannot see, start to first
prompt and per-key echo, on a pty; bench/README.md has the table.  The
release, z/OS and fuzz builds move to -O3 while the sanitizer and
coverage builds stay low: inlined frames make their reports harder to
read than the few percent they would gain.
</content>
</entry>
</feed>
