diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-09-07 06:33:46 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-09-07 06:33:46 -0700 |
commit | 4c7c4e5fc3c53fca40d619e73b891269feffa010 (patch) | |
tree | c84e008f2773c32ecf748faee1e6b784c2638586 /parser.y | |
parent | f7e9981975a28b36ae30340e11f3b79abd31e8b0 (diff) | |
download | txr-4c7c4e5fc3c53fca40d619e73b891269feffa010.tar.gz txr-4c7c4e5fc3c53fca40d619e73b891269feffa010.tar.bz2 txr-4c7c4e5fc3c53fca40d619e73b891269feffa010.zip |
linenoise: visual feedback for incomplete entry.
When a line of input is incomplete and the cursor is at the
end of that line, hitting Enter causes an uncomfortable
ambiguity. Although the cursor moves to the next line, it is
not clear whether that is because the input is being accepted,
or whether the expression which was entered is executing.
For instance, these appear to behave the same way:
> (while t[Enter][Enter]...
> (while t)[Enter][Enter]...
One is just waiting for more input; the other is sitting in
an infinite loop just echoing the newline characters.
To partially address this issue, we introduce a visual
feedback mechanism. When Enter is issued at the end of an
incomplete line, then immediately after the insertion of
Enter, the character ! is flashed twice, alerting the user
that the line is incomplete.
In other situations, there isn't any feedback. An infinite
loop or lengthy calculation like (while t) looks the same as
code which is reading input like (get-line).
* linenoise/linenoise.c (LINNOISE_FLASH_DELAY): New macro.
(flash): New static function.
(edit): Call flash to flash the ! character when Enter is
issued at the end of an incomplete line, and we are not in
paste mode.
Diffstat (limited to 'parser.y')
0 files changed, 0 insertions, 0 deletions