From f93cde25f600302b04b554a7c0115ba41e65d5ec Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Sat, 4 Jan 2025 02:47:16 -0800 Subject: [PATCH] [form-] fix underlining of substrings by FormCanvas It was underlining too few or too many characters unless the underlined pattern was at index 1 in the string. --- visidata/form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visidata/form.py b/visidata/form.py index 16bc10b84..4d57bc3b3 100644 --- a/visidata/form.py +++ b/visidata/form.py @@ -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))