Deprecated: Will eventually be replaced by drawRulerFile
(nav *nav)
| 717 | |
| 718 | // Deprecated: Will eventually be replaced by drawRulerFile |
| 719 | func (ui *ui) drawStat(nav *nav) { |
| 720 | if ui.msg != "" { |
| 721 | ui.msgWin.print(ui.screen, 0, 0, tcell.StyleDefault, ui.msg) |
| 722 | return |
| 723 | } |
| 724 | |
| 725 | curr := nav.currFile() |
| 726 | if curr == nil { |
| 727 | return |
| 728 | } |
| 729 | |
| 730 | if curr.err != nil { |
| 731 | ui.echoerrf("stat: %s", curr.err) |
| 732 | ui.msgWin.print(ui.screen, 0, 0, tcell.StyleDefault, ui.msg) |
| 733 | return |
| 734 | } |
| 735 | |
| 736 | statfmt := strings.ReplaceAll(gOpts.statfmt, "|", "\x1f") |
| 737 | replace := func(s, val string) { |
| 738 | if val == "" { |
| 739 | val = "\x00" |
| 740 | } |
| 741 | statfmt = strings.ReplaceAll(statfmt, s, val) |
| 742 | } |
| 743 | if nav.isVisualMode() { |
| 744 | replace("%m", "VISUAL") |
| 745 | replace("%M", "VISUAL") |
| 746 | } else { |
| 747 | replace("%m", "") |
| 748 | replace("%M", "NORMAL") |
| 749 | } |
| 750 | replace("%p", permString(curr.Mode())) |
| 751 | replace("%c", linkCount(curr)) |
| 752 | replace("%u", userName(curr)) |
| 753 | replace("%g", groupName(curr)) |
| 754 | replace("%s", humanize(curr.Size())) |
| 755 | replace("%S", fmt.Sprintf("%5s", humanize(curr.Size()))) |
| 756 | replace("%t", curr.ModTime().Format(gOpts.timefmt)) |
| 757 | replace("%l", sanitizeName(curr.linkTarget)) |
| 758 | |
| 759 | var fileInfo strings.Builder |
| 760 | for section := range strings.SplitSeq(statfmt, "\x1f") { |
| 761 | if !strings.Contains(section, "\x00") { |
| 762 | fileInfo.WriteString(section) |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | ui.msgWin.print(ui.screen, 0, 0, tcell.StyleDefault, fileInfo.String()) |
| 767 | } |
| 768 | |
| 769 | // Deprecated: Will eventually be replaced by drawRulerFile |
| 770 | func (ui *ui) drawRuler(nav *nav) { |
no test coverage detected