summary refs log tree commit diff
path: root/home/.config
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-23 14:19:58 -0500
committerJune McEnroe <june@causal.agency>2020-12-23 15:56:18 -0500
commit4e5215cb6185108ade86af49f123b13674fe9587 (patch)
tree0157b48b88af880c20646a7a1d975c0933dea720 /home/.config
parentBind libedit's secret filename completion function (diff)
downloadsrc-4e5215cb6185108ade86af49f123b13674fe9587.tar.gz
src-4e5215cb6185108ade86af49f123b13674fe9587.zip
Cache the expanded prompt for editline
Previously, the prompt would be expanded every time editline called the
getprompt callback. I think the code may have been written assuming that
editline only calls getprompt once per prompt, but it may actually call
it many times, for instance every time you type backspace. This results
not only in slower editing from expanding complex prompts repeatedly, it
also consumes more and more stack memory each time getprompt is called.
This can be seen by setting PS1 to some command substitution, typing
many characters at the prompt, then holding backspace and observing
memory usage. Thankfully all this stack memory is freed between prompts
by the stackmark calls around el_gets.

This change causes prompt expansion to always happen in the setprompt
call, as it would when editline is disabled, and a cached copy of the
prompt is saved for getprompt to return every time editline calls it.
Since getprompt is no longer doing expansion, the stackmark calls
surrounding el_gets can be removed.
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions
ag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe 2019-02-17Always split spans after newlinesJune McEnroe 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe