Skip to content

Commit

Permalink
fix: fix off by one debugger draw (#6886)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 23, 2024
1 parent f0199f0 commit 3344e2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/debugger/src/tui/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ impl DebuggerContext<'_> {

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

0 comments on commit 3344e2c

Please sign in to comment.