Skip to content

Commit

Permalink
Fix off-by-one error with syntax lines that are exactly the terminal …
Browse files Browse the repository at this point in the history
…width
  • Loading branch information
bakks committed Nov 22, 2023
1 parent f2e8876 commit 5b1d6cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (this *StyleCodeblocksWriter) EndOfCodeLine(w io.Writer) error {
// we want to go back to the beginning of the line to print it again with
// the syntax highlighting, but it may be longer than the terminal width
// so we calculate how many lines up we need to go
linesUp := len(lastLine(this.blockBuffer, 0)) / this.terminalWidth
linesUp := (len(lastLine(this.blockBuffer, 0)) - 1) / this.terminalWidth
if linesUp > 0 {
fmt.Fprintf(w, "\x1b[%dA", linesUp)
}
Expand Down

0 comments on commit 5b1d6cd

Please sign in to comment.