@@ -3905,6 +3905,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
39053905 frozenRight = line [splitOffsetRight :]
39063906 }
39073907 displayWidthSum := 0
3908+ displayWidthLeft := 0
39083909 todo := [3 ]func (){}
39093910 for fidx , runes := range [][]rune {frozenLeft , frozenRight , middle } {
39103911 if len (runes ) == 0 {
@@ -3930,7 +3931,11 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
39303931 // For frozen parts, reserve space for the ellipsis in the middle part
39313932 adjustedMaxWidth -= ellipsisWidth
39323933 }
3933- displayWidth = t .displayWidthWithLimit (runes , 0 , adjustedMaxWidth )
3934+ var prefixWidth int
3935+ if fidx == 2 {
3936+ prefixWidth = displayWidthLeft
3937+ }
3938+ displayWidth = t .displayWidthWithLimit (runes , prefixWidth , adjustedMaxWidth )
39343939 if ! t .wrap && displayWidth > adjustedMaxWidth {
39353940 maxe = util .Constrain (maxe + min (maxWidth / 2 - ellipsisWidth , t .hscrollOff ), 0 , len (runes ))
39363941 transformOffsets := func (diff int32 ) {
@@ -3968,14 +3973,17 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
39683973 displayWidth = t .displayWidthWithLimit (runes , 0 , maxWidth )
39693974 }
39703975 displayWidthSum += displayWidth
3976+ if fidx == 0 {
3977+ displayWidthLeft = displayWidth
3978+ }
39713979
39723980 if maxWidth > 0 {
39733981 color := colBase
39743982 if hidden {
39753983 color = color .WithFg (t .theme .Nomatch )
39763984 }
39773985 todo [fidx ] = func () {
3978- t .printColoredString (t .window , runes , offs , color )
3986+ t .printColoredString (t .window , runes , offs , color , prefixWidth )
39793987 }
39803988 } else {
39813989 break
@@ -4002,10 +4010,13 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
40024010 return finalLineNum
40034011}
40044012
4005- func (t * Terminal ) printColoredString (window tui.Window , text []rune , offsets []colorOffset , colBase tui.ColorPair ) {
4013+ func (t * Terminal ) printColoredString (window tui.Window , text []rune , offsets []colorOffset , colBase tui.ColorPair , initialPrefixWidth ... int ) {
40064014 var index int32
40074015 var substr string
40084016 var prefixWidth int
4017+ if len (initialPrefixWidth ) > 0 {
4018+ prefixWidth = initialPrefixWidth [0 ]
4019+ }
40094020 maxOffset := int32 (len (text ))
40104021 var url * url
40114022 for _ , offset := range offsets {
0 commit comments