@@ -419,6 +419,12 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
419419 }
420420 }
421421
422+ indOff , tagOff , nameOff := lnwidth , lnwidth , lnwidth + 1
423+ if ! gOpts .mergeindicators {
424+ tagOff ++
425+ nameOff ++
426+ }
427+
422428 visualSelections := dir .visualSelections ()
423429 for i , f := range dir .files [beg :end ] {
424430 st := dirStyle .colors .get (f )
@@ -458,8 +464,18 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
458464 fmtStr = gOpts .cutfmt
459465 }
460466 }
467+
468+ tag := " "
469+ if val , ok := context .tags [path ]; ok && len (val ) > 0 {
470+ tag = val
471+ }
472+
461473 if fmtStr != "" {
462- win .print (ui .screen , lnwidth , i , parseEscapeSequence (fmtStr ), " " )
474+ ind := " "
475+ if gOpts .mergeindicators {
476+ ind = tag
477+ }
478+ win .print (ui .screen , indOff , i , parseEscapeSequence (fmtStr ), ind )
463479 }
464480
465481 // make space for select marker, and leave another space at the end
@@ -469,22 +485,21 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
469485 maxWidth --
470486 }
471487
472- tag := " "
473- if val , ok := context .tags [path ]; ok && len (val ) > 0 {
474- tag = val
475- }
476-
477488 var icon []rune
478489 var iconDef iconDef
479490 if gOpts .icons {
480491 iconDef = dirStyle .icons .get (f )
481492 icon = slices .Concat ([]rune (iconDef .icon ), []rune {' ' })
482493 }
483494
484- // subtract space for tag and icon
485- maxFilenameWidth := maxWidth - 1 - runeSliceWidth (icon )
495+ // subtract space for icon
496+ maxFilenameWidth := maxWidth - runeSliceWidth (icon )
497+ // subtract space for tag if not merged with selection marker
498+ if ! gOpts .mergeindicators {
499+ maxFilenameWidth --
500+ }
486501
487- info , custom , off := fileInfo (f , dir , userWidth , groupWidth , customWidth )
502+ info , custom , customOff := fileInfo (f , dir , userWidth , groupWidth , customWidth )
488503 infolen := len (info )
489504 showInfo := infolen > 0 && 2 * infolen < maxWidth
490505 if showInfo {
@@ -498,7 +513,7 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
498513
499514 if showInfo {
500515 filename = append (filename , []rune (info )... )
501- off += lnwidth + 2 + runeSliceWidth (icon ) + maxFilenameWidth
516+ customOff += nameOff + runeSliceWidth (icon ) + maxFilenameWidth
502517 }
503518
504519 if i == dir .pos {
@@ -513,37 +528,41 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
513528 }
514529
515530 // print tag separately as it can contain color escape sequences
516- win .print (ui .screen , lnwidth + 1 , i , st , fmt .Sprintf (cursorFmt , tag ))
531+ if ! gOpts .mergeindicators || fmtStr == "" {
532+ win .print (ui .screen , tagOff , i , st , fmt .Sprintf (cursorFmt , tag ))
533+ }
517534
518535 line := slices .Concat (icon , filename , []rune {' ' })
519- win .print (ui .screen , lnwidth + 2 , i , st , fmt .Sprintf (cursorFmt , string (line )))
536+ win .print (ui .screen , nameOff , i , st , fmt .Sprintf (cursorFmt , string (line )))
520537
521538 // print over the empty space we reserved for the custom info
522539 if showInfo && custom != "" {
523- win .print (ui .screen , off , i , st , fmt .Sprintf (cursorFmt , stripTermSequence (custom )))
540+ win .print (ui .screen , customOff , i , st , fmt .Sprintf (cursorFmt , stripTermSequence (custom )))
524541 }
525542 } else {
526- if tag == " " {
527- win .print (ui .screen , lnwidth + 1 , i , st , " " )
528- } else {
529- tagStr := fmt .Sprintf (optionToFmtstr (gOpts .tagfmt ), tag )
530- win .print (ui .screen , lnwidth + 1 , i , tcell .StyleDefault , tagStr )
543+ if ! gOpts .mergeindicators || fmtStr == "" {
544+ if tag == " " {
545+ win .print (ui .screen , tagOff , i , st , " " )
546+ } else {
547+ tagStr := fmt .Sprintf (optionToFmtstr (gOpts .tagfmt ), tag )
548+ win .print (ui .screen , tagOff , i , tcell .StyleDefault , tagStr )
549+ }
531550 }
532551
533552 if len (icon ) > 0 {
534553 iconStyle := st
535554 if iconDef .hasStyle {
536555 iconStyle = iconDef .style
537556 }
538- win .print (ui .screen , lnwidth + 2 , i , iconStyle , string (icon ))
557+ win .print (ui .screen , nameOff , i , iconStyle , string (icon ))
539558 }
540559
541560 line := slices .Concat (filename , []rune {' ' })
542- win .print (ui .screen , lnwidth + 2 + runeSliceWidth (icon ), i , st , string (line ))
561+ win .print (ui .screen , nameOff + runeSliceWidth (icon ), i , st , string (line ))
543562
544563 // print over the empty space we reserved for the custom info
545564 if showInfo && custom != "" {
546- win .print (ui .screen , off , i , st , custom )
565+ win .print (ui .screen , customOff , i , st , custom )
547566 }
548567 }
549568 }
0 commit comments