Skip to content

Commit

Permalink
[form-] fix underlining of substrings by FormCanvas
Browse files Browse the repository at this point in the history
It was underlining too few or too many characters unless the
underlined pattern was at index 1 in the string.
  • Loading branch information
midichef authored and anjakefala committed Jan 14, 2025
1 parent 94d1b6f commit f93cde2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion visidata/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def draw(self, scr):
# underline first occurrence of r.key in r.text
if hasattr(r, 'key') and r.key:
index = r.text.find(r.key)
clipdraw(scr, y, x+index, r.text[index:len(r.key)+1], colors[color + " underline"])
clipdraw(scr, y, x+index, r.text[index:index+len(r.key)], colors[color + " underline"])
vd.onMouse(scr, x, y, dispwidth(r.text), 1,
BUTTON1_PRESSED=lambda y,x,key,r=r,sheet=self: sheet.onPressed(r),
BUTTON1_RELEASED=lambda y,x,key,r=r,sheet=self: sheet.onReleased(r))
Expand Down

0 comments on commit f93cde2

Please sign in to comment.