Skip to content

Commit 3344e2c

Browse files
authored
fix: fix off by one debugger draw (#6886)
1 parent f0199f0 commit 3344e2c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/debugger/src/tui/draw.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ impl DebuggerContext<'_> {
237237

238238
// adjust what text we show of the source code
239239
let (start_line, end_line) = if needed_highlight > height {
240-
// highlighted section is more lines than we have avail
241-
(before.len(), before.len() + needed_highlight)
240+
// highlighted section is more lines than we have available
241+
let start_line = before.len().saturating_sub(1);
242+
(start_line, before.len() + needed_highlight)
242243
} else if height > num_lines {
243244
// we can fit entire source
244245
(0, num_lines)

0 commit comments

Comments
 (0)