fix blank output after exiting confirm via Esc #2839
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After exiting a confirm with any of
Esc
/^C
/^Q
/q
, a status message appears with 5 blank lines.To test, try to overwrite an existing file:
vd sample_data/benchmark.csv
pressi
,^S
Enter
and then when the confirm message appears:Esc
The 5 blank lines are produced from the blank Exception:
exc(``)
:visidata/visidata/form.py
Lines 117 to 119 in c7c83d8
That empty string gets turned into vd markup of
[:error][/]
, which is an empty tag. Empty tags are not handled properly bywraptext()
. They turn into 5 nearly empty tuples:list(wraptext('[:error][/]')) == [('', ''), ('[:error]', ''), ('', ''), ('[/]', ''), ('', '')]
, which get turned into 5 blank lines. So I have 1 commit to catch that case. That's needed for correctness in display.With that fix, hitting
Esc
afterconfirm()
makes just 1 blank line instead of 5. The second commit then addresses the remaning blank line. It treatsEsc
/^C
/^Q
/q
the same as presses ofn
, showing the samedisconfirmed:
message. Is that intended behavior? Or isEsc
intended to produce an escape that can be distinguished from ann
?