Files
zyedidia.micro/cmd/micro/util/message.go
2019-12-25 17:05:10 -05:00

35 lines
899 B
Go

package util
import (
"bufio"
"fmt"
"os"
"strconv"
"github.com/zyedidia/micro/cmd/micro/screen"
)
// TermMessage sends a message to the user in the terminal. This usually occurs before
// micro has been fully initialized -- ie if there is an error in the syntax highlighting
// regular expressions
// The function must be called when the Screen is not initialized
// This will write the message, and wait for the user
// to press and key to continue
func TermMessage(msg ...interface{}) {
screen.TempFini()
fmt.Println(msg...)
fmt.Print("\nPress enter to continue")
reader := bufio.NewReader(os.Stdin)
reader.ReadString('\n')
screen.TempStart()
}
// TermError sends an error to the user in the terminal. Like TermMessage except formatted
// as an error
func TermError(filename string, lineNum int, err string) {
TermMessage(filename + ", " + strconv.Itoa(lineNum) + ": " + err)
}