bug fix
This commit is contained in:
parent
538445a201
commit
95503ec65a
8
io.go
8
io.go
@ -54,7 +54,7 @@ func messageBox(hint string, defaultVal string) InputMsg {
|
||||
if len(strValue) == 0 {
|
||||
strValue = defaultVal
|
||||
}
|
||||
return InputMsg{msg: "", err: err}
|
||||
return InputMsg{msg: strValue, err: err}
|
||||
}
|
||||
if b == 0x08 || b == 0x7F {
|
||||
if len(ioBuf) > 0 {
|
||||
@ -101,7 +101,7 @@ func passwd(hint string, defaultVal string, mask string) InputMsg {
|
||||
if len(strValue) == 0 {
|
||||
strValue = defaultVal
|
||||
}
|
||||
return InputMsg{msg: "", err: err}
|
||||
return InputMsg{msg: strValue, err: err}
|
||||
}
|
||||
if b == 0x08 || b == 0x7F {
|
||||
if len(ioBuf) > 0 {
|
||||
@ -131,13 +131,13 @@ func MessageBox(hint string, defaultVal string) InputMsg {
|
||||
inputReader := bufio.NewReader(os.Stdin)
|
||||
str, err := inputReader.ReadString('\n')
|
||||
if err != nil {
|
||||
return InputMsg{msg: "", err: err}
|
||||
return InputMsg{msg: str, err: err}
|
||||
}
|
||||
str = strings.TrimSpace(str)
|
||||
if len(str) == 0 {
|
||||
str = defaultVal
|
||||
}
|
||||
return InputMsg{msg: "", err: err}
|
||||
return InputMsg{msg: str, err: err}
|
||||
}
|
||||
|
||||
func (im InputMsg) IgnoreSliceParseError(i bool) InputMsg {
|
||||
|
Loading…
x
Reference in New Issue
Block a user