(nav *nav)
| 879 | } |
| 880 | |
| 881 | func (ui *ui) drawRulerFile(nav *nav) { |
| 882 | if ui.rulerErr != nil { |
| 883 | err := fmt.Sprintf(optionToFmtstr(gOpts.errorfmt), sanitizeName(fmt.Sprintf("parsing ruler: %s", ui.rulerErr))) |
| 884 | ui.msgWin.print(ui.screen, 0, 0, tcell.StyleDefault, err) |
| 885 | return |
| 886 | } |
| 887 | |
| 888 | var stat *statData |
| 889 | curr := nav.currFile() |
| 890 | if curr != nil { |
| 891 | if curr.err == nil { |
| 892 | stat = &statData{ |
| 893 | Path: sanitizeName(curr.path), |
| 894 | Name: sanitizeName(curr.Name()), |
| 895 | Extension: sanitizeName(curr.ext), |
| 896 | Size: curr.Size(), |
| 897 | DirSize: curr.dirSize, |
| 898 | DirCount: curr.dirCount, |
| 899 | Permissions: permString(curr.Mode()), |
| 900 | ModTime: curr.ModTime().Format(gOpts.timefmt), |
| 901 | AccessTime: curr.accessTime.Format(gOpts.timefmt), |
| 902 | BirthTime: curr.birthTime.Format(gOpts.timefmt), |
| 903 | ChangeTime: curr.changeTime.Format(gOpts.timefmt), |
| 904 | LinkCount: linkCount(curr), |
| 905 | User: userName(curr), |
| 906 | Group: groupName(curr), |
| 907 | Target: sanitizeName(curr.linkTarget), |
| 908 | CustomInfo: curr.customInfo, |
| 909 | } |
| 910 | } else { |
| 911 | ui.echoerrf("stat: %s", curr.err) |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | dir := nav.currDir() |
| 916 | tot := len(dir.files) |
| 917 | ind := min(dir.ind+1, tot) |
| 918 | all := len(dir.allFiles) |
| 919 | hid := all - tot |
| 920 | |
| 921 | var linePercentage string |
| 922 | if tot == 0 { |
| 923 | linePercentage = "100%" |
| 924 | } else { |
| 925 | linePercentage = fmt.Sprintf("%d%%", ind*100/tot) |
| 926 | } |
| 927 | |
| 928 | var scrollPercentage string |
| 929 | beg := max(dir.ind-dir.pos, 0) |
| 930 | switch { |
| 931 | case tot <= nav.height: |
| 932 | scrollPercentage = "All" |
| 933 | case beg == 0: |
| 934 | scrollPercentage = "Top" |
| 935 | case beg == tot-nav.height: |
| 936 | scrollPercentage = "Bot" |
| 937 | default: |
| 938 | scrollPercentage = fmt.Sprintf("%2d%%", beg*100/(tot-nav.height)) |
no test coverage detected