fix cursor
This commit is contained in:
parent
3f1b876f68
commit
ada7fa9d9e
@ -20,6 +20,7 @@ func Escape_handler(reader *bufio.Reader, history_index int, input string, env e
|
||||
if history_index > 0 {
|
||||
history_index--
|
||||
input = env.History[history_index]
|
||||
cursor = len(input)
|
||||
}
|
||||
case 66: //B
|
||||
if history_index < len(env.History)-1 {
|
||||
@ -30,12 +31,17 @@ func Escape_handler(reader *bufio.Reader, history_index int, input string, env e
|
||||
input = ""
|
||||
cursor = 0
|
||||
}
|
||||
cursor = len(input)
|
||||
case 68: //D
|
||||
if cursor > 0 {
|
||||
cursor--
|
||||
}
|
||||
|
||||
case 67: //C
|
||||
if prevGhostString != "" {
|
||||
input = input + prevGhostString
|
||||
cursor = len(input)
|
||||
}
|
||||
if cursor < len(input) {
|
||||
cursor++
|
||||
}
|
||||
|
||||
@ -93,6 +93,7 @@ func input_str(env *environment.Env) string {
|
||||
switch r_rune {
|
||||
case 3: // ^C
|
||||
fmt.Println("^C")
|
||||
cursor = 0
|
||||
input = ""
|
||||
case 4: // ^D
|
||||
input = "exit"
|
||||
@ -100,8 +101,6 @@ func input_str(env *environment.Env) string {
|
||||
case 9: // TAB
|
||||
input = AutoComplete(input)
|
||||
cursor = len(input)
|
||||
case 62: // '>'
|
||||
input = input + prevGhostString
|
||||
case 27: // Escape
|
||||
input, history_index, cursor = Escape_handler(reader, history_index, input, *env, cursor)
|
||||
case 127: //packspace
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user