Skip to content
Myr

Fix highlight offsets of multi-line entries

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix regression from 4811e52a

authored by Junegunn Choi · committed by Junegunn Choi · parent b99cb63 · Browse files · 3 files+4 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−8 removed

  • other:+4 added−8 removed

3 files+4 added−8 removed

modified:src/ansi.go+1 added
276 unmodified lines
277 }278279 if code == "\n" {280 output.WriteRune('\n')281 runeCount++282 // Full-background marker283 if newState.lbg >= 0 {284 marker := newState285 marker.attr |= tui.FullBg
227 unmodified lines
modified:src/core.go+1 added-1 removed
79 unmodified lines
80 trimmed, offsets, newState := extractColor(byteString(data), lineAnsiState, nil)81 lineAnsiState = newState8283 // Full line background is found. Add a special marker.84 if !opts.ReadZero && offsets != nil && newState != nil && len(*offsets) > 0 && newState.lbg >= 0 {84 if offsets != nil && newState != nil && len(*offsets) > 0 && newState.lbg >= 0 {85 marker := (*offsets)[len(*offsets)-1]86 marker.offset[0] = marker.offset[1]87 marker.color.bg = newState.lbg88 marker.color.attr = marker.color.attr | tui.FullBg
444 unmodified lines
modified:src/terminal.go+2 added-7 removed
3397 unmodified lines
3398 line := lines[lineOffset]3399 finalLineNum = lineNum3400 offsets := []colorOffset{}3401 lbg := tui.NoColorPair()3402 var lineLen int3402 for idx, offset := range allOffsets {3404 lineLen = len(line)3405 if lineLen > 0 && line[lineLen-1] == '\n' {3406 lineLen--3407 }3408 lineEnd := int32(from + lineLen)3403 lineEnd := int32(from + len(line))3404 if offset.offset[0] >= lineEnd {3405 if offset.IsFullBgMarker(lineEnd) {3406 lbg = offset.color3407 }
27 unmodified lines
3435 allOffsets = append([]colorOffset{dupe}, allOffsets[idx+1:]...)3436 break3437 }3438 }3444 from += lineLen3439 from += len(line)3440 if lineOffset < skipLines {3441 continue3442 }3443 actualLineOffset := lineOffset - skipLines
3470 unmodified lines