diff --git a/diacritics.go b/diacritics.go index 110a04f4..09564744 100644 --- a/diacritics.go +++ b/diacritics.go @@ -33,7 +33,7 @@ func appendTransliterate(base, norm string, uppercase bool) { lenNorm := len(normRunes) lenBase := len(baseRunes) if lenNorm != lenBase { - panic("Base and normalized strings have differend lenght: base=" + strconv.Itoa(lenBase) + ", norm=" + strconv.Itoa(lenNorm)) // programmer error in constant lenght + panic("Base and normalized strings have differend length: base=" + strconv.Itoa(lenBase) + ", norm=" + strconv.Itoa(lenNorm)) // programmer error in constant length } for i, baseRune := range baseRunes { diff --git a/etc/lf.fish b/etc/lf.fish index 95f70099..9749cf9d 100644 --- a/etc/lf.fish +++ b/etc/lf.fish @@ -1,13 +1,18 @@ -# Autocompletion for Fish shell -# Put this file somewhere in $fish_complete_path -# for example in ~/.config/fish/completions/ +# Autocompletion for fish shell. +# +# You may put this file to a directory in $fish_complete_path variable: +# +# mkdir -p ~/.config/fish/completions +# ln -s "/path/to/lf.fish" ~/.config/fish/completions +# -complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile' -complete -c lf -o doc -d 'show documentation' -complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)' -complete -c lf -o memprofile -r -d 'path to the file to write the memory profile' -complete -c lf -o remote -x -d 'send remote command to server' -complete -c lf -o selection-path -r -d 'path to the file to write selected files on open (to use as open file dialog)' -complete -c lf -o server -d 'start server (automatic)' -complete -c lf -o version -d 'show version' -complete -c lf -s h -d "short help" +complete -c lf -o command -r -d 'command to execute on client initialization' +complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile' +complete -c lf -o doc -d 'show documentation' +complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)' +complete -c lf -o memprofile -r -d 'path to the file to write the memory profile' +complete -c lf -o remote -x -d 'send remote command to server' +complete -c lf -o selection-path -r -d 'path to the file to write selected files on open (to use as open file dialog)' +complete -c lf -o server -d 'start server (automatic)' +complete -c lf -o version -d 'show version' +complete -c lf -o help -d 'show help' diff --git a/misc.go b/misc.go index ec16a3dd..f9c2dc2a 100644 --- a/misc.go +++ b/misc.go @@ -133,11 +133,10 @@ func splitWord(s string) (word, rest string) { return } -// This function converts a size in bytes to a human readable form. For this -// purpose metric suffixes are used (e.g. 1K = 1000). For values less than 10 -// the first significant digit is shown, otherwise it is hidden. Numbers are -// always rounded down. For these reasons this function always show somewhat -// smaller values but it should be fine for most human beings. +// This function converts a size in bytes to a human readable form using metric +// suffixes (e.g. 1K = 1000). For values less than 10 the first significant +// digit is shown, otherwise it is hidden. Numbers are always rounded down. +// This should be fine for most human beings. func humanize(size int64) string { if size < 1000 { return fmt.Sprintf("%dB", size) diff --git a/ui.go b/ui.go index 5cc861f4..5a2e5b77 100644 --- a/ui.go +++ b/ui.go @@ -246,17 +246,13 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b return } - fg, bg := termbox.ColorDefault, termbox.ColorDefault - if dir.loading { - fg = termbox.AttrReverse - win.print(2, 0, fg, bg, "loading...") + win.print(2, 0, termbox.AttrReverse, termbox.ColorDefault, "loading...") return } if len(dir.files) == 0 { - fg = termbox.AttrReverse - win.print(2, 0, fg, bg, "empty") + win.print(2, 0, termbox.AttrReverse, termbox.ColorDefault, "empty") return } @@ -267,8 +263,8 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b return } - var lnwidth int = 0 - var lnformat string = "" + var lnwidth int + var lnformat string if gOpts.number || gOpts.relativenumber { lnwidth = 1 @@ -279,7 +275,7 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b } for i, f := range dir.files[beg:end] { - fg, bg = colors.get(f) + fg, bg := colors.get(f) if lnwidth > 0 { var ln string @@ -862,8 +858,6 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) { log.Printf("converting command count: %s", err) } count = c - } else { - count = 1 } expr := gOpts.keys[string(ui.keyAcc)] if e, ok := expr.(*callExpr); ok { @@ -885,8 +879,6 @@ func (ui *ui) readEvent(ch chan<- expr, ev termbox.Event) { log.Printf("converting command count: %s", err) } count = c - } else { - count = 1 } expr := gOpts.keys[string(ui.keyAcc)] if e, ok := expr.(*callExpr); ok {