mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -15,8 +16,8 @@ import (
|
|||||||
// The function must be called when the screen is not initialized
|
// The function must be called when the screen is not initialized
|
||||||
// This will write the message, and wait for the user
|
// This will write the message, and wait for the user
|
||||||
// to press and key to continue
|
// to press and key to continue
|
||||||
func TermMessage(msg string) {
|
func TermMessage(msg ...interface{}) {
|
||||||
fmt.Println(msg)
|
fmt.Println(msg...)
|
||||||
fmt.Print("\nPress enter to continue")
|
fmt.Print("\nPress enter to continue")
|
||||||
|
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
@@ -49,8 +50,10 @@ type Messenger struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Message sends a message to the user
|
// Message sends a message to the user
|
||||||
func (m *Messenger) Message(msg string) {
|
func (m *Messenger) Message(msg ...interface{}) {
|
||||||
m.message = msg
|
buf := new(bytes.Buffer)
|
||||||
|
fmt.Fprint(buf, msg...)
|
||||||
|
m.message = buf.String()
|
||||||
m.style = defStyle
|
m.style = defStyle
|
||||||
|
|
||||||
if _, ok := colorscheme["message"]; ok {
|
if _, ok := colorscheme["message"]; ok {
|
||||||
@@ -60,8 +63,10 @@ func (m *Messenger) Message(msg string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Error sends an error message to the user
|
// Error sends an error message to the user
|
||||||
func (m *Messenger) Error(msg string) {
|
func (m *Messenger) Error(msg ...interface{}) {
|
||||||
m.message = msg
|
buf := new(bytes.Buffer)
|
||||||
|
fmt.Fprint(buf, msg...)
|
||||||
|
m.message = buf.String()
|
||||||
m.style = defStyle.
|
m.style = defStyle.
|
||||||
Foreground(tcell.ColorBlack).
|
Foreground(tcell.ColorBlack).
|
||||||
Background(tcell.ColorMaroon)
|
Background(tcell.ColorMaroon)
|
||||||
|
|||||||
Reference in New Issue
Block a user