Skip to content

Commit

Permalink
🐛 print line+column range correctly (#5224)
Browse files Browse the repository at this point in the history
There was a mixup with how this method works, because it adds line start
+ end before adding each column. I had it sorted differently earlier and
  this was a leftover on the CLI printer that messed it up.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
  • Loading branch information
arlimus authored Feb 14, 2025
1 parent 04d8c72 commit 6e6ac1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llx/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ func (r Range) String() string {
case 4:
res.WriteString(strconv.Itoa(int(x[0])))
res.WriteString(":")
res.WriteString(strconv.Itoa(int(x[1])))
res.WriteString("-")
res.WriteString(strconv.Itoa(int(x[2])))
res.WriteString("-")
res.WriteString(strconv.Itoa(int(x[1])))
res.WriteString(":")
res.WriteString(strconv.Itoa(int(x[3])))
}
Expand Down
2 changes: 1 addition & 1 deletion llx/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestRange(t *testing.T) {
})

t.Run("line and column range", func(t *testing.T) {
r := RangePrimitive(NewRange().AddLineColumnRange(12, 3, 12345678, 1234567))
r := RangePrimitive(NewRange().AddLineColumnRange(12, 12345678, 3, 1234567))
assert.Equal(t, "12:3-12345678:1234567", r.LabelV2(nil))
})
}
Expand Down

0 comments on commit 6e6ac1c

Please sign in to comment.