fix: improve preview message alignment (#2400)
* fix: improve message alignment * docs: update `CHANGELOG.md`
This commit is contained in:
1 parent
214965b5e7
commit
9ab0fd4de0
2 files changed
+20
-14
No files matched your search
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|||||||
- The `dircounts` indicator for errors is changed back to `!` instead of `?` (#2372).
|
- The `dircounts` indicator for errors is changed back to `!` instead of `?` (#2372).
|
||||||
- The `select` command can now select files immediately after creation as part of a script (#2377).
|
- The `select` command can now select files immediately after creation as part of a script (#2377).
|
||||||
- The `on-load` hook command now ignores `.git` directories to reduce flicker and repeated `on-load` triggers (#2382).
|
- The `on-load` hook command now ignores `.git` directories to reduce flicker and repeated `on-load` triggers (#2382).
|
||||||
|
- Preview messages like `empty` or `loading...` have their alignment improved (#2400).
|
||||||
|
|
||||||
## [r41](https://github.com/gokcehan/lf/releases/tag/r41)
|
## [r41](https://github.com/gokcehan/lf/releases/tag/r41)
|
||||||
|
|
||||||
|
|||||||
@@ -247,12 +247,20 @@ func (win *win) printRight(screen tcell.Screen, y int, st tcell.Style, s string)
|
|||||||
win.print(screen, win.w-printLength(s), y, st, s)
|
win.print(screen, win.w-printLength(s), y, st, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (win *win) printMsg(screen tcell.Screen, s string) {
|
||||||
|
pad := 1
|
||||||
|
if gOpts.mergeindicators {
|
||||||
|
pad--
|
||||||
|
}
|
||||||
|
st := tcell.StyleDefault.Reverse(true)
|
||||||
|
win.print(screen, pad, 0, st, s)
|
||||||
|
}
|
||||||
|
|
||||||
func (win *win) printReg(screen tcell.Screen, reg *reg, previewLoading bool, sxs *sixelScreen) {
|
func (win *win) printReg(screen tcell.Screen, reg *reg, previewLoading bool, sxs *sixelScreen) {
|
||||||
switch {
|
switch {
|
||||||
case reg.loading:
|
case reg.loading:
|
||||||
if previewLoading {
|
if previewLoading {
|
||||||
st := tcell.StyleDefault.Reverse(true)
|
win.printMsg(screen, "loading...")
|
||||||
win.print(screen, 2, 0, st, "loading...")
|
|
||||||
}
|
}
|
||||||
case reg.sixel:
|
case reg.sixel:
|
||||||
sxs.printSixel(win, screen, reg)
|
sxs.printSixel(win, screen, reg)
|
||||||
@@ -366,20 +374,17 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
messageStyle := tcell.StyleDefault.Reverse(true)
|
|
||||||
|
|
||||||
if dir.noPerm {
|
|
||||||
win.print(ui.screen, 2, 0, messageStyle, "permission denied")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fileslen := len(dir.files)
|
fileslen := len(dir.files)
|
||||||
if dir.loading && fileslen == 0 {
|
|
||||||
win.print(ui.screen, 2, 0, messageStyle, "loading...")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if fileslen == 0 {
|
switch {
|
||||||
win.print(ui.screen, 2, 0, messageStyle, "empty")
|
case dir.noPerm:
|
||||||
|
win.printMsg(ui.screen, "permission denied")
|
||||||
|
return
|
||||||
|
case dir.loading && fileslen == 0:
|
||||||
|
win.printMsg(ui.screen, "loading...")
|
||||||
|
return
|
||||||
|
case fileslen == 0:
|
||||||
|
win.printMsg(ui.screen, "empty")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user