* initial tags implementation

* add tag to complete.go

* add gTagsPath to os_windows.go

* change behaviour to match other commands

* add tag-toggle to complete.go

* add tag and tag-toggle to docs

* address feedback about tags
This commit is contained in:
Santos authored and GitHub committed 2022-03-28 15:43:05 +03:00
1 parent 2f9d840eda
commit 5a5628d667
11 files changed
+440 -205

No files matched your search

+15 -3
View File
@@ -324,7 +324,7 @@ func fileInfo(f *file, d *dir) string {
return info
}
func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]int, saves map[string]bool, colors styleMap, icons iconMap) {
func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]int, saves map[string]bool, tags map[string]string, colors styleMap, icons iconMap) {
if win.w < 5 || dir == nil {
return
}
@@ -449,6 +449,18 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]in
s = append(s, ' ')
win.print(screen, lnwidth+1, i, st, string(s))
tag, ok := tags[path]
if ok {
st = st.Reverse(false)
fg, bg, _ := st.Decompose()
if i == dir.pos {
win.print(screen, lnwidth+1, i, st.Background(fg), fmt.Sprintf(gOpts.tagfmt, tag))
} else {
win.print(screen, lnwidth+1, i, st.Background(bg), fmt.Sprintf(gOpts.tagfmt, tag))
}
}
}
}
@@ -839,7 +851,7 @@ func (ui *ui) draw(nav *nav) {
doff := len(nav.dirs) - length
for i := 0; i < length; i++ {
ui.wins[woff+i].printDir(ui.screen, nav.dirs[doff+i], nav.selections, nav.saves, ui.styles, ui.icons)
ui.wins[woff+i].printDir(ui.screen, nav.dirs[doff+i], nav.selections, nav.saves, nav.tags, ui.styles, ui.icons)
}
switch ui.cmdPrefix {
@@ -873,7 +885,7 @@ func (ui *ui) draw(nav *nav) {
preview := ui.wins[len(ui.wins)-1]
if curr.IsDir() {
preview.printDir(ui.screen, ui.dirPrev, nav.selections, nav.saves, ui.styles, ui.icons)
preview.printDir(ui.screen, ui.dirPrev, nav.selections, nav.saves, nav.tags, ui.styles, ui.icons)
} else if curr.Mode().IsRegular() {
preview.printReg(ui.screen, ui.regPrev)
}