cleanup
This commit is contained in:
1 parent
4c0efdcb41
commit
c071e37316
4 files changed
+9
-10
No files matched your search
@@ -12,8 +12,6 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
type cmdItem struct {
|
||||
@@ -34,10 +32,7 @@ type app struct {
|
||||
cmdHistoryInd int
|
||||
}
|
||||
|
||||
func newApp(screen tcell.Screen) *app {
|
||||
ui := newUI(screen)
|
||||
nav := newNav(ui.wins[0].h)
|
||||
|
||||
func newApp(ui *ui, nav *nav) *app {
|
||||
quitChan := make(chan struct{}, 1)
|
||||
|
||||
app := &app{
|
||||
@@ -160,6 +155,8 @@ func (app *app) writeHistory() error {
|
||||
// for evaluation. Similarly directories and regular files are also read in
|
||||
// separate goroutines and sent here for update.
|
||||
func (app *app) loop() {
|
||||
go app.nav.previewLoop(app.ui)
|
||||
|
||||
serverChan := readExpr()
|
||||
|
||||
app.ui.readExpr()
|
||||
|
||||
@@ -35,7 +35,9 @@ func run() {
|
||||
|
||||
log.Print("hi!")
|
||||
|
||||
app := newApp(screen)
|
||||
ui := newUI(screen)
|
||||
nav := newNav(ui.wins[0].h)
|
||||
app := newApp(ui, nav)
|
||||
|
||||
if err := app.nav.readMarks(); err != nil {
|
||||
app.ui.echoerrf("reading marks file: %s", err)
|
||||
@@ -45,8 +47,8 @@ func run() {
|
||||
app.ui.echoerrf("reading history file: %s", err)
|
||||
}
|
||||
|
||||
go app.nav.previewLoop(app.ui)
|
||||
app.loop()
|
||||
|
||||
app.ui.screen.Fini()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -250,7 +250,7 @@ func matchFile(s string) (matches []string, longest string) {
|
||||
f, err := os.Stat(name)
|
||||
if err != nil {
|
||||
fl, err := os.Lstat(name)
|
||||
if err == nil && fl.Mode() & os.ModeSymlink != 0 {
|
||||
if err == nil && fl.Mode()&os.ModeSymlink != 0 {
|
||||
continue
|
||||
} else {
|
||||
log.Printf("getting file information: %s", err)
|
||||
|
||||
@@ -112,7 +112,7 @@ func copyAll(srcs []string, dstDir string) (nums chan int64, errs chan error) {
|
||||
errs <- fmt.Errorf("mkdir: %s", err)
|
||||
}
|
||||
nums <- info.Size()
|
||||
} else if info.Mode() & os.ModeSymlink != 0 { /* Symlink */
|
||||
} else if info.Mode()&os.ModeSymlink != 0 { /* Symlink */
|
||||
if rlink, err := os.Readlink(path); err != nil {
|
||||
errs <- fmt.Errorf("symlink: %s", err)
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user