display raw idx output, stop mangling session list
This commit is contained in:
parent
ff9c517b23
commit
34ace61c4a
21
main.go
21
main.go
|
|
@ -2,7 +2,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -73,27 +72,15 @@ func (sl *sessionList) refresh() {
|
||||||
|
|
||||||
sl.mu.Lock()
|
sl.mu.Lock()
|
||||||
sl.allSIDs = nil
|
sl.allSIDs = nil
|
||||||
var buf strings.Builder
|
|
||||||
for _, l := range lines {
|
for _, l := range lines {
|
||||||
s := strings.TrimSpace(l)
|
if s := strings.TrimSpace(l); s != "" {
|
||||||
if s == "" {
|
id, _, _ := strings.Cut(s, "\t")
|
||||||
continue
|
sl.allSIDs = append(sl.allSIDs, id)
|
||||||
}
|
}
|
||||||
fields := strings.Split(s, "\t")
|
|
||||||
id := fields[0]
|
|
||||||
sl.allSIDs = append(sl.allSIDs, id)
|
|
||||||
parts := strings.Split(id, "__")
|
|
||||||
indent := strings.Repeat(" ", len(parts)-1)
|
|
||||||
leaf := parts[len(parts)-1]
|
|
||||||
cwd := ""
|
|
||||||
if len(fields) > 2 {
|
|
||||||
cwd = "\t" + fields[2]
|
|
||||||
}
|
|
||||||
fmt.Fprintf(&buf, "%s%s%s\n", indent, leaf, cwd)
|
|
||||||
}
|
}
|
||||||
sl.mu.Unlock()
|
sl.mu.Unlock()
|
||||||
|
|
||||||
sl.win.Write("body", []byte(buf.String()))
|
sl.win.Write("body", []byte(raw+"\n"))
|
||||||
sl.win.Ctl("clean")
|
sl.win.Ctl("clean")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue