Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions visidata/cliptext.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ def wraptext(text, width=80, indent=''):
line = _markdown_to_internal(line)
chunks = re.split(internal_markup_re, line)
textchunks = [x for x in chunks if not is_vdcode(x)]
if ''.join(textchunks) == '': #for markup with no contents, like '[:tag][/]' or '[:]' or '[/]'
yield '', ''
continue
# textwrap.wrap does not handle variable-width characters #2416
for linenum, textline in enumerate(textwrap.wrap(''.join(textchunks), width=width, drop_whitespace=False)):
txt = textline
Expand Down
11 changes: 6 additions & 5 deletions visidata/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run(self, scr):
@functools.wraps(VisiData.confirm)
@VisiData.api
def confirm(vd, prompt, exc=EscapeException):
'Display *prompt* on status line and demand input that starts with "Y" or "y" to proceed. Raise *exc* otherwise. Return True.'
'Display *prompt* on status line and demand input that starts with "Y" or "y" to proceed. Return True when proceeding, otherwise raise *exc*, or if *exc* is falsy, return False'
if vd.options.batch:
return vd.fail('cannot confirm in batch mode: ' + prompt)

Expand All @@ -115,10 +115,11 @@ def confirm(vd, prompt, exc=EscapeException):
])

ret = FormCanvas(source=form).run(vd.scrFull)
if not ret:
raise exc('')
yn = ret['yn'][:1]
if not yn or yn not in 'Yy':
confirmed = False # default is to disconfirm, if user exited the confirmation via: Esc ^C ^Q q
if ret:
yn = ret['yn'][:1]
confirmed = yn and yn in 'Yy'
if not confirmed:
msg = 'disconfirmed: ' + prompt
if exc:
raise exc(msg)
Expand Down