Skip to content

Commit 2f12675

Browse files
committed
Fix substr mathing errors in Text Input
1 parent 717c56f commit 2f12675

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/Terminal/Widgets/Input/Text.rakumod

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,17 @@ class Terminal::Widgets::Input::Text
121121

122122
my $refresh = $.input-field.render(:$edited);
123123
my $start = $.input-field.field-start;
124-
my $pos = $start
125-
+ $.input-field.left-mark-width
124+
my $pos = $.input-field.left-mark-width
126125
+ $.input-field.scroll-to-insert-width;
127126

128127
self.clear-frame;
129128
self.draw-framing;
130129

131130
my $tree = span-tree(:$color,
132131
string-span($.prompt-string, color => $prompt),
133-
($refresh.substr(0, $pos - 1) if $pos),
132+
($refresh.substr(0, $pos)),
134133
string-span($refresh.substr($pos, 1), color => $cursor),
135-
($refresh.substr($pos + 1) if $pos + $start < $w));
134+
($refresh.substr($pos + 1) if $pos < $refresh.chars));
136135

137136
my @spans = $.terminal.locale.render($tree);
138137
self.draw-line-spans($x, $y, $w, @spans);

0 commit comments

Comments
 (0)