From c630293cc250b76b3cc0543ac6cb6ff8424a4d26 Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Wed, 22 Jul 2020 01:53:02 +0300 Subject: [PATCH] Print message in status line after copying/moving (#427) * Print message in status line after copying/moving * Print message only when there's no errors * Don't print number of copied files * Fix error handling * Send message to channel instead of direct ui.echo --- nav.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nav.go b/nav.go index 68e4a48..f369877 100644 --- a/nav.go +++ b/nav.go @@ -694,6 +694,13 @@ loop: echo.args[0] = fmt.Sprintf("[%d] %s", errCount, err) ui.exprChan <- echo } + + if errCount == 0 { + echosuccess := &callExpr{"echo", []string{""}, 1} + echosuccess.args[0] = "\033[0;32mCopied successfully\033[0m" + + ui.exprChan <- echosuccess + } } func (nav *nav) moveAsync(ui *ui, srcs []string, dstDir string) { @@ -790,6 +797,13 @@ func (nav *nav) moveAsync(ui *ui, srcs []string, dstDir string) { echo.args[0] = fmt.Sprintf("[%d] %s", errCount, err) ui.exprChan <- echo } + + if errCount == 0 { + echosuccess := &callExpr{"echo", []string{""}, 1} + echosuccess.args[0] = "\033[0;32mMoved successfully\033[0m" + + ui.exprChan <- echosuccess + } } func (nav *nav) paste(ui *ui) error {