Compare commits

...

5 Commits

Author SHA1 Message Date
Michael Peters
516185b5e8 Merge branch 'master' into michael 2022-06-26 15:50:34 -05:00
Michael Peters
503a659983 remove loading... indicator (since it's annoying) 2022-06-26 15:50:06 -05:00
Gokcehan
aee5c3371f handle colons in paths for tags properly
cc #857
2022-06-26 15:36:17 +03:00
SeekingBlues
36a7a18316
Go to normal mode when backspacing on empty prompt (#836)
This matches up with vim's behavior.
2022-05-21 13:54:17 +03:00
SeekingBlues
2104a501aa
Fix user name, group name and link count display (#829)
These type assertions for `Stat_t` were changed from `syscall` to
the incorrect `unix` ones in c5bd676.

Fixes #800.
2022-05-12 19:25:50 +03:00
5 changed files with 15 additions and 8 deletions

View File

@ -1916,6 +1916,7 @@ func (e *callExpr) eval(app *app, args []string) {
update(app) update(app)
case "cmd-delete-back": case "cmd-delete-back":
if len(app.ui.cmdAccLeft) == 0 { if len(app.ui.cmdAccLeft) == 0 {
normal(app)
return return
} }
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1] app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]

2
makefile Normal file
View File

@ -0,0 +1,2 @@
install:
env CGO_ENABLED=0 go install --ldflags="-s -w"

9
nav.go
View File

@ -1667,9 +1667,12 @@ func (nav *nav) readTags() error {
scanner := bufio.NewScanner(f) scanner := bufio.NewScanner(f)
for scanner.Scan() { for scanner.Scan() {
toks := strings.SplitN(scanner.Text(), ":", 2) text := scanner.Text()
if _, ok := nav.tags[toks[0]]; !ok { ind := strings.LastIndex(text, ":")
nav.tags[toks[0]] = toks[1] path := text[0:ind]
mark := text[ind+1:]
if _, ok := nav.tags[path]; !ok {
nav.tags[path] = mark
} }
} }

7
os.go
View File

@ -11,6 +11,7 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
"syscall"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -177,7 +178,7 @@ func isHidden(f os.FileInfo, path string, hiddenfiles []string) bool {
} }
func userName(f os.FileInfo) string { func userName(f os.FileInfo) string {
if stat, ok := f.Sys().(*unix.Stat_t); ok { if stat, ok := f.Sys().(*syscall.Stat_t); ok {
if u, err := user.LookupId(fmt.Sprint(stat.Uid)); err == nil { if u, err := user.LookupId(fmt.Sprint(stat.Uid)); err == nil {
return fmt.Sprintf("%v ", u.Username) return fmt.Sprintf("%v ", u.Username)
} }
@ -186,7 +187,7 @@ func userName(f os.FileInfo) string {
} }
func groupName(f os.FileInfo) string { func groupName(f os.FileInfo) string {
if stat, ok := f.Sys().(*unix.Stat_t); ok { if stat, ok := f.Sys().(*syscall.Stat_t); ok {
if g, err := user.LookupGroupId(fmt.Sprint(stat.Gid)); err == nil { if g, err := user.LookupGroupId(fmt.Sprint(stat.Gid)); err == nil {
return fmt.Sprintf("%v ", g.Name) return fmt.Sprintf("%v ", g.Name)
} }
@ -195,7 +196,7 @@ func groupName(f os.FileInfo) string {
} }
func linkCount(f os.FileInfo) string { func linkCount(f os.FileInfo) string {
if stat, ok := f.Sys().(*unix.Stat_t); ok { if stat, ok := f.Sys().(*syscall.Stat_t); ok {
return fmt.Sprintf("%v ", stat.Nlink) return fmt.Sprintf("%v ", stat.Nlink)
} }
return "" return ""

4
ui.go
View File

@ -261,7 +261,7 @@ func (win *win) printReg(screen tcell.Screen, reg *reg) {
if reg.loading { if reg.loading {
st = st.Reverse(true) st = st.Reverse(true)
win.print(screen, 2, 0, st, "loading...") // win.print(screen, 2, 0, st, "loading...")
return return
} }
@ -335,7 +335,7 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, selections map[string]in
} }
if dir.loading && len(dir.files) == 0 { if dir.loading && len(dir.files) == 0 {
win.print(screen, 2, 0, tcell.StyleDefault.Reverse(true), "loading...") // win.print(screen, 2, 0, tcell.StyleDefault.Reverse(true), "loading...")
return return
} }