use reverse attribute for preview messages

This commit is contained in:
Gokcehan 2019-02-28 22:10:57 +03:00
parent 4d2a628550
commit f44ec4f5bd
3 changed files with 9 additions and 4 deletions

5
app.go
View File

@ -163,6 +163,11 @@ func (app *app) loop() {
for { for {
select { select {
case <-app.quitChan: case <-app.quitChan:
if app.nav.copyTotal > 0 {
app.ui.echoerr("quit: copy operation in progress")
continue
}
log.Print("bye!") log.Print("bye!")
if err := app.nav.writeMarks(); err != nil { if err := app.nav.writeMarks(); err != nil {

2
nav.go
View File

@ -389,7 +389,7 @@ func (nav *nav) preview() {
for i := 0; i < nav.height && buf.Scan(); i++ { for i := 0; i < nav.height && buf.Scan(); i++ {
for _, r := range buf.Text() { for _, r := range buf.Text() {
if r == 0 { if r == 0 {
reg.lines = []string{"\033[mbinary\033[0m"} reg.lines = []string{"\033[7mbinary\033[0m"}
nav.regChan <- reg nav.regChan <- reg
return return
} }

6
ui.go
View File

@ -182,7 +182,7 @@ func (win *win) printReg(reg *reg) {
fg, bg := termbox.ColorDefault, termbox.ColorDefault fg, bg := termbox.ColorDefault, termbox.ColorDefault
if reg.loading { if reg.loading {
fg = termbox.AttrBold fg = termbox.AttrReverse
win.print(2, 0, fg, bg, "loading...") win.print(2, 0, fg, bg, "loading...")
return return
} }
@ -249,13 +249,13 @@ func (win *win) printDir(dir *dir, selections map[string]int, saves map[string]b
fg, bg := termbox.ColorDefault, termbox.ColorDefault fg, bg := termbox.ColorDefault, termbox.ColorDefault
if dir.loading { if dir.loading {
fg = termbox.AttrBold fg = termbox.AttrReverse
win.print(2, 0, fg, bg, "loading...") win.print(2, 0, fg, bg, "loading...")
return return
} }
if len(dir.files) == 0 { if len(dir.files) == 0 {
fg = termbox.AttrBold fg = termbox.AttrReverse
win.print(2, 0, fg, bg, "empty") win.print(2, 0, fg, bg, "empty")
return return
} }