Add "eof" action which closes the finder only when input is empty

Close #289
This commit is contained in:
Junegunn Choi
2015-07-22 22:56:53 +09:00
parent b53f61fc59
commit cc0d5539ba
5 changed files with 23 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ const (
actClearScreen
actDeleteChar
actEndOfLine
actEof
actForwardChar
actForwardWord
actKillLine
@@ -813,6 +814,10 @@ func (t *Terminal) Loop() {
}
case actEndOfLine:
t.cx = len(t.input)
case actEof:
if len(t.input) == 0 {
req(reqQuit)
}
case actForwardChar:
if t.cx < len(t.input) {
t.cx++