Skip to content

fix blank output after exiting confirm via Esc #2839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

midichef
Copy link
Contributor

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 press i, ^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

ret = FormCanvas(source=form).run(vd.scrFull)
if not ret:
raise exc('')

That empty string gets turned into vd markup of [:error][/], which is an empty tag. Empty tags are not handled properly by wraptext(). 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 after confirm() makes just 1 blank line instead of 5. The second commit then addresses the remaning blank line. It treats Esc/^C/^Q/q the same as presses of n, showing the same disconfirmed: message. Is that intended behavior? Or is Esc intended to produce an escape that can be distinguished from an n?

Empty markup like "[:error][/]" would become 5 blank lines.
Text of "[:]" or "[/]" would become 3 blank lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant