use reverse style for tags for the selection

cc #791
This commit is contained in:
Gokcehan 2022-03-28 15:50:10 +03:00
parent 5a5628d667
commit 27a11ae507
4 changed files with 219 additions and 222 deletions

12
doc.go
View File

@ -71,8 +71,8 @@ The following commands are provided by lf:
mark-save (modal) (default 'm') mark-save (modal) (default 'm')
mark-load (modal) (default "'") mark-load (modal) (default "'")
mark-remove (modal) (default `"`) mark-remove (modal) (default `"`)
tag-toggle (default t)
tag tag
tag-toggle (default t)
The following command line commands are provided by lf: The following command line commands are provided by lf:
@ -107,6 +107,7 @@ The following options can be used to customize the behavior of lf:
anchorfind bool (default on) anchorfind bool (default on)
autoquit bool (default off) autoquit bool (default off)
cleaner string (default '')
dircache bool (default on) dircache bool (default on)
dircounts bool (default off) dircounts bool (default off)
dirfirst bool (default on) dirfirst bool (default on)
@ -125,12 +126,13 @@ The following options can be used to customize the behavior of lf:
incfilter bool (default off) incfilter bool (default off)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
mouse bool (default off) mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '')
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
@ -143,15 +145,13 @@ The following options can be used to customize the behavior of lf:
smartdia bool (default off) smartdia bool (default off)
sortby string (default 'natural') sortby string (default 'natural')
tabstop int (default 8) tabstop int (default 8)
tagfmt string (default "\033[31m%s\033[0m")
tempmarks string (default '') tempmarks string (default '')
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue') waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
tagfmt string (default "\033[31m%s\033[0m")
The following environment variables are exported for shell commands: The following environment variables are exported for shell commands:
@ -469,7 +469,7 @@ Remove a bookmark assigned to the given key.
Tag a file with a single width character given in the argument. Tag a file with a single width character given in the argument.
tag-toggle (modal) (default 't') tag-toggle (default 't')
Tag a file with a single width character given in the argument if the file is untagged, otherwise remove the tag. Tag a file with a single width character given in the argument if the file is untagged, otherwise remove the tag.

View File

@ -76,8 +76,8 @@ The following commands are provided by lf:
mark-save (modal) (default 'm') mark-save (modal) (default 'm')
mark-load (modal) (default "'") mark-load (modal) (default "'")
mark-remove (modal) (default '"') mark-remove (modal) (default '"')
tag-toggle (default t)
tag tag
tag-toggle (default t)
The following command line commands are provided by lf: The following command line commands are provided by lf:
@ -112,6 +112,7 @@ The following options can be used to customize the behavior of lf:
anchorfind bool (default on) anchorfind bool (default on)
autoquit bool (default off) autoquit bool (default off)
cleaner string (default '')
dircache bool (default on) dircache bool (default on)
dircounts bool (default off) dircounts bool (default off)
dirfirst bool (default on) dirfirst bool (default on)
@ -130,12 +131,13 @@ The following options can be used to customize the behavior of lf:
incfilter bool (default off) incfilter bool (default off)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
mouse bool (default off) mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '')
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m") promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
@ -148,15 +150,13 @@ The following options can be used to customize the behavior of lf:
smartdia bool (default off) smartdia bool (default off)
sortby string (default 'natural') sortby string (default 'natural')
tabstop int (default 8) tabstop int (default 8)
tagfmt string (default "\033[31m%s\033[0m")
tempmarks string (default '') tempmarks string (default '')
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue') waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
tagfmt string (default "\033[31m%s\033[0m")
The following environment variables are exported for shell commands: The following environment variables are exported for shell commands:
@ -494,7 +494,7 @@ Remove a bookmark assigned to the given key.
Tag a file with a single width character given in the argument. Tag a file with a single width character given in the argument.
tag-toggle (modal) (default 't') tag-toggle (default 't')
Tag a file with a single width character given in the argument if the file Tag a file with a single width character given in the argument if the file
is untagged, otherwise remove the tag. is untagged, otherwise remove the tag.

12
lf.1
View File

@ -86,8 +86,8 @@ The following commands are provided by lf:
mark-save (modal) (default 'm') mark-save (modal) (default 'm')
mark-load (modal) (default "'") mark-load (modal) (default "'")
mark-remove (modal) (default `"`) mark-remove (modal) (default `"`)
tag-toggle (default t)
tag tag
tag-toggle (default t)
.EE .EE
.PP .PP
The following command line commands are provided by lf: The following command line commands are provided by lf:
@ -126,6 +126,7 @@ The following options can be used to customize the behavior of lf:
.EX .EX
anchorfind bool (default on) anchorfind bool (default on)
autoquit bool (default off) autoquit bool (default off)
cleaner string (default '')
dircache bool (default on) dircache bool (default on)
dircounts bool (default off) dircounts bool (default off)
dirfirst bool (default on) dirfirst bool (default on)
@ -144,12 +145,13 @@ The following options can be used to customize the behavior of lf:
incfilter bool (default off) incfilter bool (default off)
incsearch bool (default off) incsearch bool (default off)
info []string (default '') info []string (default '')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
mouse bool (default off) mouse bool (default off)
number bool (default off) number bool (default off)
period int (default 0) period int (default 0)
preview bool (default on) preview bool (default on)
previewer string (default '') previewer string (default '')
cleaner string (default '')
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m") promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
ratios []int (default '1:2:3') ratios []int (default '1:2:3')
relativenumber bool (default off) relativenumber bool (default off)
@ -162,15 +164,13 @@ The following options can be used to customize the behavior of lf:
smartdia bool (default off) smartdia bool (default off)
sortby string (default 'natural') sortby string (default 'natural')
tabstop int (default 8) tabstop int (default 8)
tagfmt string (default "\e033[31m%s\e033[0m")
tempmarks string (default '') tempmarks string (default '')
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
infotimefmtnew string (default 'Jan _2 15:04')
infotimefmtold string (default 'Jan _2 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue') waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
tagfmt string (default "\e033[31m%s\e033[0m")
.EE .EE
.PP .PP
The following environment variables are exported for shell commands: The following environment variables are exported for shell commands:
@ -582,7 +582,7 @@ Remove a bookmark assigned to the given key.
Tag a file with a single width character given in the argument. Tag a file with a single width character given in the argument.
.PP .PP
.EX .EX
tag-toggle (modal) (default 't') tag-toggle (default 't')
.EE .EE
.PP .PP
Tag a file with a single width character given in the argument if the file is untagged, otherwise remove the tag. Tag a file with a single width character given in the argument if the file is untagged, otherwise remove the tag.

7
ui.go
View File

@ -452,13 +452,10 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]in
tag, ok := tags[path] tag, ok := tags[path]
if ok { if ok {
st = st.Reverse(false)
fg, bg, _ := st.Decompose()
if i == dir.pos { if i == dir.pos {
win.print(screen, lnwidth+1, i, st.Background(fg), fmt.Sprintf(gOpts.tagfmt, tag)) win.print(screen, lnwidth+1, i, tcell.StyleDefault.Reverse(true), fmt.Sprintf(gOpts.tagfmt, tag))
} else { } else {
win.print(screen, lnwidth+1, i, st.Background(bg), fmt.Sprintf(gOpts.tagfmt, tag)) win.print(screen, lnwidth+1, i, tcell.StyleDefault, fmt.Sprintf(gOpts.tagfmt, tag))
} }
} }
} }