micro/internal/screen/message.go

33 lines
858 B
Go
Raw Normal View History

2019-01-14 02:06:58 +00:00
package screen
2018-08-26 03:06:44 +00:00
import (
"bufio"
"fmt"
"os"
"strconv"
)
// 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
2018-08-27 19:53:10 +00:00
// The function must be called when the Screen is not initialized
2018-08-26 03:06:44 +00:00
// This will write the message, and wait for the user
// to press and key to continue
func TermMessage(msg ...interface{}) {
2019-01-14 02:06:58 +00:00
screenb := TempFini()
2018-08-26 03:06:44 +00:00
fmt.Println(msg...)
fmt.Print("\nPress enter to continue")
reader := bufio.NewReader(os.Stdin)
reader.ReadString('\n')
2019-01-14 02:06:58 +00:00
TempStart(screenb)
2018-08-26 03:06:44 +00:00
}
// 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)
}