Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve refreshing of file statinfo #1536

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,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)
}
}
Expand Down
3 changes: 1 addition & 2 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,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
Expand Down
10 changes: 7 additions & 3 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ type ui struct {
msgWin *win
menuWin *win
msg string
msgIsStat bool
regPrev *reg
dirPrev *dir
exprChan chan expr
Expand Down Expand Up @@ -596,6 +597,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),
Expand Down Expand Up @@ -653,10 +655,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)
}

Expand All @@ -669,7 +672,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)
}

Expand Down Expand Up @@ -754,7 +757,8 @@ func (ui *ui) loadFileInfo(nav *nav) {
}
}

ui.echo(fileInfo)
ui.msg = fileInfo
ui.msgIsStat = true
}

func (ui *ui) drawPromptLine(nav *nav) {
Expand Down