Skip to content

Commit

Permalink
[sidebar-] do not crash if whitespace-only
Browse files Browse the repository at this point in the history
  • Loading branch information
saulpw committed Oct 19, 2023
1 parent 8eed9f7 commit f32a043
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion visidata/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ def drawSidebarText(sheet, scr, text:str, title:str='', overflowmsg:str='', bott
maxw = sheet.options.disp_sidebar_width or scrw//2
maxh = sheet.options.disp_sidebar_height or scrh-2

text = textwrap.dedent(text.strip('\n'))

if not text:
return

text = textwrap.dedent(text.strip('\n'))
lines = text.splitlines()
if not title and lines and lines[0].strip().startswith('# '):
title = lines[0][1:].strip()
Expand Down

0 comments on commit f32a043

Please sign in to comment.