1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

readline: use new enum syntax

This commit is contained in:
Don Alfons Nisnoni 2019-10-31 19:06:48 +08:00 committed by Alexander Medvednikov
parent 5acdf425ab
commit 0c229aacdd

View File

@ -151,20 +151,20 @@ pub fn read_line(prompt string) ?string {
fn (r Readline) analyse(c int) Action { fn (r Readline) analyse(c int) Action {
match c { match c {
`\0` { return Action.eof } `\0` { return .eof }
0x3 { return Action.eof } // End of Text 0x3 { return .eof } // End of Text
0x4 { return Action.eof } // End of Transmission 0x4 { return .eof } // End of Transmission
255 { return Action.eof } 255 { return .eof }
`\n` { return Action.commit_line } `\n` { return .commit_line }
`\r` { return Action.commit_line } `\r` { return .commit_line }
`\f` { return Action.clear_screen } // CTRL + L `\f` { return .clear_screen } // CTRL + L
`\b` { return Action.delete_left } // Backspace `\b` { return .delete_left } // Backspace
127 { return Action.delete_left } // DEL 127 { return .delete_left } // DEL
27 { return r.analyse_control() } // ESC 27 { return r.analyse_control() } // ESC
1 { return Action.move_cursor_begining } // ^A 1 { return .move_cursor_begining } // ^A
5 { return Action.move_cursor_end } // ^E 5 { return .move_cursor_end } // ^E
26 { return Action.suspend } // CTRL + Z, SUB 26 { return .suspend } // CTRL + Z, SUB
else { return if c >= ` ` { Action.insert_character } else { Action.nothing } } else { return if c >= ` ` { .insert_character } else { Action.nothing } }
} }
} }