Skip to content

Commit

Permalink
Fix end of previous line wrongly being included in highlight
Browse files Browse the repository at this point in the history
when the highlight span starts at the very begining of a line, the highlight currently includes the line above
  • Loading branch information
icewind1991 committed Sep 12, 2021
1 parent eb07d5b commit 4d4c0fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handlers/graphical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,11 @@ impl Line {

fn span_applies(&self, span: &FancySpan) -> bool {
// Span starts in this line
(span.offset() >= self.offset && span.offset() <= self.offset +self.length)
(span.offset() >= self.offset && span.offset() < self.offset +self.length)
// Span passes through this line
|| (span.offset() < self.offset && span.offset() + span.len() > self.offset + self.length) //todo
// Span ends on this line
|| (span.offset() + span.len() >= self.offset && span.offset() + span.len() <= self.offset + self.length)
|| (span.offset() + span.len() >= self.offset && span.offset() + span.len() < self.offset + self.length)
}

// A "flyby" is a multi-line span that technically covers this line, but
Expand Down

0 comments on commit 4d4c0fb

Please sign in to comment.