Improve refreshing of file statinfo (#1536)

This commit is contained in:
Joe Lim authored and GitHub committed 2023-12-26 15:56:20 +01:00
1 parent e1ab72516d
commit 12ce649681
3 files changed
+9 -6

No files matched your search

+1 -1
View File
@@ -405,7 +405,7 @@ func (app *app) loop() {
if err == nil {
if d.path == app.nav.currDir().path {
app.ui.loadFile(app, true)
if app.ui.msg == "" {
if app.ui.msgIsStat {
app.ui.loadFileInfo(app.nav)
}
}
+1 -2
View File
@@ -1960,8 +1960,7 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.echoerrf("reload: %s", err)
}
app.ui.loadFile(app, true)
// clear file information, will be loaded asynchronously
app.ui.msg = ""
app.ui.loadFileInfo(app.nav)
case "read":
if app.ui.cmdPrefix == ">" {
return
+7 -3
View File
@@ -568,6 +568,7 @@ type ui struct {
msgWin *win
menuWin *win
msg string
msgIsStat bool
regPrev *reg
dirPrev *dir
exprChan chan expr
@@ -598,6 +599,7 @@ func newUI(screen tcell.Screen) *ui {
promptWin: newWin(wtot, 1, 0, 0),
msgWin: newWin(wtot, 1, 0, htot-1),
menuWin: newWin(wtot, 1, 0, htot-2),
msgIsStat: true,
exprChan: make(chan expr, 1000),
keyChan: make(chan string, 1000),
tevChan: make(chan tcell.Event, 1000),
@@ -655,10 +657,11 @@ func (ui *ui) sort() {
func (ui *ui) echo(msg string) {
ui.msg = msg
ui.msgIsStat = false
}
func (ui *ui) echomsg(msg string) {
ui.msg = msg
ui.echo(msg)
log.Print(msg)
}
@@ -671,7 +674,7 @@ func optionToFmtstr(optstr string) string {
}
func (ui *ui) echoerr(msg string) {
ui.msg = fmt.Sprintf(optionToFmtstr(gOpts.errorfmt), msg)
ui.echo(fmt.Sprintf(optionToFmtstr(gOpts.errorfmt), msg))
log.Printf("error: %s", msg)
}
@@ -756,7 +759,8 @@ func (ui *ui) loadFileInfo(nav *nav) {
}
}
ui.echo(fileInfo)
ui.msg = fileInfo
ui.msgIsStat = true
}
func (ui *ui) drawPromptLine(nav *nav) {