Skip to content
Myr

Fix invalid highlighting of truncated multi-line items

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 50fa90d · Browse files · 1 file+9 added−4 removed
This commit

State

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

Diff stats

1 file+9 added−4 removed

  • other:+9 added−4 removed

1 file+9 added−4 removed

modified:src/terminal.go+9 added-4 removed
2273 unmodified lines
2274 numItemLines := len(lines)22752276 finalLineNum := lineNum2277 topCutoff := false2278 skipLines := 02279 wrapped := false2280 if t.multiLine || t.wrap {2281 // Cut off the upper lines in the 'default' layout2282 if t.layout == layoutDefault && !current && maxLines == numItemLines && overflow {
4 unmodified lines
2287 if len(prevLine) == 0 || prevLine[len(prevLine)-1] != '\n' {2288 wrapped = true2289 }22902290 lines = lines[len(lines)-maxLines:]2291 skipLines = len(lines) - maxLines2292 topCutoff = true2293 }2294 }2295 from := 0
27 unmodified lines
2323 break2324 }2325 }2326 from += len(line)2327 if lineOffset < skipLines {2328 continue2329 }2330 actualLineOffset := lineOffset - skipLines23312332 var maxe int2333 for _, offset := range offsets {2334 if offset.match {
2 unmodified lines
2337 }23382339 actualLineNum := lineNum2340 if t.layout == layoutDefault {2336 actualLineNum = (lineNum - lineOffset) + (numItemLines - lineOffset) - 12341 actualLineNum = (lineNum - actualLineOffset) + (numItemLines - actualLineOffset) - 12342 }2343 t.move(actualLineNum, 0, forceRedraw)23442345 if preTask != nil {
6 unmodified lines
2352 } else {2353 marker = markerTop2354 }2355 } else {2351 if lineOffset == 0 { // First line2356 if actualLineOffset == 0 { // First line2357 if topCutoff {2358 marker = markerMiddle2359 } else {2360 marker = markerTop2361 }2357 } else if lineOffset == numItemLines-1 { // Last line2362 } else if actualLineOffset == numItemLines-1 { // Last line2363 if topCutoff || !overflow {2364 marker = markerBottom2365 } else {2366 marker = markerMiddle
2661 unmodified lines