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

14
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

@ -21,63 +21,63 @@ Quick Reference
The following commands are provided by lf: The following commands are provided by lf:
quit (default 'q') quit (default 'q')
up (default 'k' and '<up>') up (default 'k' and '<up>')
half-up (default '<c-u>') half-up (default '<c-u>')
page-up (default '<c-b>' and '<pgup>') page-up (default '<c-b>' and '<pgup>')
scrollup (default '<c-y>') scrollup (default '<c-y>')
down (default 'j' and '<down>') down (default 'j' and '<down>')
half-down (default '<c-d>') half-down (default '<c-d>')
page-down (default '<c-f>' and '<pgdn>') page-down (default '<c-f>' and '<pgdn>')
scrolldown (default '<c-e>') scrolldown (default '<c-e>')
updir (default 'h' and '<left>') updir (default 'h' and '<left>')
open (default 'l' and '<right>') open (default 'l' and '<right>')
top (default 'gg' and '<home>') top (default 'gg' and '<home>')
bottom (default 'G' and '<end>') bottom (default 'G' and '<end>')
toggle toggle
invert (default 'v') invert (default 'v')
unselect (default 'u') unselect (default 'u')
glob-select glob-select
glob-unselect glob-unselect
calcdirsize calcdirsize
copy (default 'y') copy (default 'y')
cut (default 'd') cut (default 'd')
paste (default 'p') paste (default 'p')
clear (default 'c') clear (default 'c')
sync sync
draw draw
redraw (default '<c-l>') redraw (default '<c-l>')
load load
reload (default '<c-r>') reload (default '<c-r>')
echo echo
echomsg echomsg
echoerr echoerr
cd cd
select select
delete (modal) delete (modal)
rename (modal) (default 'r') rename (modal) (default 'r')
source source
push push
read (modal) (default ':') read (modal) (default ':')
shell (modal) (default '$') shell (modal) (default '$')
shell-pipe (modal) (default '%') shell-pipe (modal) (default '%')
shell-wait (modal) (default '!') shell-wait (modal) (default '!')
shell-async (modal) (default '&') shell-async (modal) (default '&')
find (modal) (default 'f') find (modal) (default 'f')
find-back (modal) (default 'F') find-back (modal) (default 'F')
find-next (default ';') find-next (default ';')
find-prev (default ',') find-prev (default ',')
search (modal) (default '/') search (modal) (default '/')
search-back (modal) (default '?') search-back (modal) (default '?')
search-next (default 'n') search-next (default 'n')
search-prev (default 'N') search-prev (default 'N')
filter (modal) filter (modal)
setfilter setfilter
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:
@ -110,53 +110,53 @@ The following command line commands are provided by lf:
The following options can be used to customize the behavior of lf: 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)
dircache bool (default on) cleaner string (default '')
dircounts bool (default off) dircache bool (default on)
dirfirst bool (default on) dircounts bool (default off)
dironly bool (default off) dirfirst bool (default on)
drawbox bool (default off) dironly bool (default off)
errorfmt string (default "\033[7;31;47m%s\033[0m") drawbox bool (default off)
filesep string (default "\n") errorfmt string (default "\033[7;31;47m%s\033[0m")
findlen int (default 1) filesep string (default "\n")
globsearch bool (default off) findlen int (default 1)
hidden bool (default off) globsearch bool (default off)
hiddenfiles []string (default '.*') hidden bool (default off)
icons bool (default off) hiddenfiles []string (default '.*')
ifs string (default '') icons bool (default off)
ignorecase bool (default on) ifs string (default '')
ignoredia bool (default on) ignorecase bool (default on)
incfilter bool (default off) ignoredia bool (default on)
incsearch bool (default off) incfilter bool (default off)
info []string (default '') incsearch bool (default off)
mouse bool (default off) info []string (default '')
number bool (default off) infotimefmtnew string (default 'Jan _2 15:04')
period int (default 0) infotimefmtold string (default 'Jan _2 2006')
preview bool (default on) mouse bool (default off)
previewer string (default '') number bool (default off)
cleaner string (default '') period int (default 0)
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m") preview bool (default on)
ratios []int (default '1:2:3') previewer string (default '')
relativenumber bool (default off) promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
reverse bool (default off) ratios []int (default '1:2:3')
scrolloff int (default 0) relativenumber bool (default off)
shell string (default 'sh' for unix and 'cmd' for windows) reverse bool (default off)
shellflag string (default '-c' for unix and '/c' for windows) scrolloff int (default 0)
shellopts []string (default '') shell string (default 'sh' for unix and 'cmd' for windows)
smartcase bool (default on) shellflag string (default '-c' for unix and '/c' for windows)
smartdia bool (default off) shellopts []string (default '')
sortby string (default 'natural') smartcase bool (default on)
tabstop int (default 8) smartdia bool (default off)
tempmarks string (default '') sortby string (default 'natural')
timefmt string (default 'Mon Jan _2 15:04:05 2006') tabstop int (default 8)
infotimefmtnew string (default 'Jan _2 15:04') tagfmt string (default "\033[31m%s\033[0m")
infotimefmtold string (default 'Jan _2 2006') tempmarks string (default '')
truncatechar string (default '~') timefmt string (default 'Mon Jan _2 15:04:05 2006')
waitmsg string (default 'Press any key to continue') truncatechar string (default '~')
wrapscan bool (default on) waitmsg string (default 'Press any key to continue')
wrapscroll bool (default off) wrapscan bool (default on)
tagfmt string (default "\033[31m%s\033[0m") wrapscroll bool (default off)
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.

210
lf.1
View File

@ -31,63 +31,63 @@ You can run 'lf -help' to see descriptions of command line options.
The following commands are provided by lf: The following commands are provided by lf:
.PP .PP
.EX .EX
quit (default 'q') quit (default 'q')
up (default 'k' and '<up>') up (default 'k' and '<up>')
half-up (default '<c-u>') half-up (default '<c-u>')
page-up (default '<c-b>' and '<pgup>') page-up (default '<c-b>' and '<pgup>')
scrollup (default '<c-y>') scrollup (default '<c-y>')
down (default 'j' and '<down>') down (default 'j' and '<down>')
half-down (default '<c-d>') half-down (default '<c-d>')
page-down (default '<c-f>' and '<pgdn>') page-down (default '<c-f>' and '<pgdn>')
scrolldown (default '<c-e>') scrolldown (default '<c-e>')
updir (default 'h' and '<left>') updir (default 'h' and '<left>')
open (default 'l' and '<right>') open (default 'l' and '<right>')
top (default 'gg' and '<home>') top (default 'gg' and '<home>')
bottom (default 'G' and '<end>') bottom (default 'G' and '<end>')
toggle toggle
invert (default 'v') invert (default 'v')
unselect (default 'u') unselect (default 'u')
glob-select glob-select
glob-unselect glob-unselect
calcdirsize calcdirsize
copy (default 'y') copy (default 'y')
cut (default 'd') cut (default 'd')
paste (default 'p') paste (default 'p')
clear (default 'c') clear (default 'c')
sync sync
draw draw
redraw (default '<c-l>') redraw (default '<c-l>')
load load
reload (default '<c-r>') reload (default '<c-r>')
echo echo
echomsg echomsg
echoerr echoerr
cd cd
select select
delete (modal) delete (modal)
rename (modal) (default 'r') rename (modal) (default 'r')
source source
push push
read (modal) (default ':') read (modal) (default ':')
shell (modal) (default '$') shell (modal) (default '$')
shell-pipe (modal) (default '%') shell-pipe (modal) (default '%')
shell-wait (modal) (default '!') shell-wait (modal) (default '!')
shell-async (modal) (default '&') shell-async (modal) (default '&')
find (modal) (default 'f') find (modal) (default 'f')
find-back (modal) (default 'F') find-back (modal) (default 'F')
find-next (default ';') find-next (default ';')
find-prev (default ',') find-prev (default ',')
search (modal) (default '/') search (modal) (default '/')
search-back (modal) (default '?') search-back (modal) (default '?')
search-next (default 'n') search-next (default 'n')
search-prev (default 'N') search-prev (default 'N')
filter (modal) filter (modal)
setfilter setfilter
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:
@ -124,53 +124,53 @@ The following command line commands are provided by lf:
The following options can be used to customize the behavior of lf: The following options can be used to customize the behavior of lf:
.PP .PP
.EX .EX
anchorfind bool (default on) anchorfind bool (default on)
autoquit bool (default off) autoquit bool (default off)
dircache bool (default on) cleaner string (default '')
dircounts bool (default off) dircache bool (default on)
dirfirst bool (default on) dircounts bool (default off)
dironly bool (default off) dirfirst bool (default on)
drawbox bool (default off) dironly bool (default off)
errorfmt string (default "\e033[7;31;47m%s\e033[0m") drawbox bool (default off)
filesep string (default "\en") errorfmt string (default "\e033[7;31;47m%s\e033[0m")
findlen int (default 1) filesep string (default "\en")
globsearch bool (default off) findlen int (default 1)
hidden bool (default off) globsearch bool (default off)
hiddenfiles []string (default '.*') hidden bool (default off)
icons bool (default off) hiddenfiles []string (default '.*')
ifs string (default '') icons bool (default off)
ignorecase bool (default on) ifs string (default '')
ignoredia bool (default on) ignorecase bool (default on)
incfilter bool (default off) ignoredia bool (default on)
incsearch bool (default off) incfilter bool (default off)
info []string (default '') incsearch bool (default off)
mouse bool (default off) info []string (default '')
number bool (default off) infotimefmtnew string (default 'Jan _2 15:04')
period int (default 0) infotimefmtold string (default 'Jan _2 2006')
preview bool (default on) mouse bool (default off)
previewer string (default '') number bool (default off)
cleaner string (default '') period int (default 0)
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m") preview bool (default on)
ratios []int (default '1:2:3') previewer string (default '')
relativenumber bool (default off) promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
reverse bool (default off) ratios []int (default '1:2:3')
scrolloff int (default 0) relativenumber bool (default off)
shell string (default 'sh' for unix and 'cmd' for windows) reverse bool (default off)
shellflag string (default '-c' for unix and '/c' for windows) scrolloff int (default 0)
shellopts []string (default '') shell string (default 'sh' for unix and 'cmd' for windows)
smartcase bool (default on) shellflag string (default '-c' for unix and '/c' for windows)
smartdia bool (default off) shellopts []string (default '')
sortby string (default 'natural') smartcase bool (default on)
tabstop int (default 8) smartdia bool (default off)
tempmarks string (default '') sortby string (default 'natural')
timefmt string (default 'Mon Jan _2 15:04:05 2006') tabstop int (default 8)
infotimefmtnew string (default 'Jan _2 15:04') tagfmt string (default "\e033[31m%s\e033[0m")
infotimefmtold string (default 'Jan _2 2006') tempmarks string (default '')
truncatechar string (default '~') timefmt string (default 'Mon Jan _2 15:04:05 2006')
waitmsg string (default 'Press any key to continue') truncatechar string (default '~')
wrapscan bool (default on) waitmsg string (default 'Press any key to continue')
wrapscroll bool (default off) wrapscan bool (default on)
tagfmt string (default "\e033[31m%s\e033[0m") wrapscroll bool (default off)
.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))
} }
} }
} }