mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples/text_editor: edit multiple files (#6827)
This commit is contained in:

committed by
GitHub

parent
50163508f8
commit
827fb62c29
@@ -53,7 +53,7 @@ fn restore_terminal_state() {
|
||||
fn (mut ctx Context) termios_setup() {
|
||||
// store the current title, so restore_terminal_state can get it back
|
||||
ctx.save_title()
|
||||
|
||||
|
||||
mut termios := get_termios()
|
||||
|
||||
if ctx.cfg.capture_events {
|
||||
@@ -205,8 +205,8 @@ fn single_char(buf string) &Event {
|
||||
|
||||
|
||||
// The bit `or`s here are really just `+`'s, just written in this way for a tiny performance improvement
|
||||
// 10 == `\n` == enter, don't treat it as ctrl + j
|
||||
1 ... 9, 11 ... 26 { event = &Event{ typ: event.typ, ascii: event.ascii, utf8: event.utf8, code: KeyCode(96 | ch), modifiers: ctrl } }
|
||||
// don't treat tab, enter as ctrl+i, ctrl+j
|
||||
1 ... 8, 11 ... 26 { event = &Event{ typ: event.typ, ascii: event.ascii, utf8: event.utf8, code: KeyCode(96 | ch), modifiers: ctrl } }
|
||||
65 ... 90 { event = &Event{ typ: event.typ, ascii: event.ascii, utf8: event.utf8, code: KeyCode(32 | ch), modifiers: shift } }
|
||||
|
||||
else {}
|
||||
@@ -343,6 +343,11 @@ fn escape_sequence(buf_ string) (&Event, int) {
|
||||
else {}
|
||||
}
|
||||
|
||||
if buf == '[Z' {
|
||||
code = .tab
|
||||
modifiers |= shift
|
||||
}
|
||||
|
||||
if buf.len == 5 && buf[0] == `[` && buf[1].is_digit() && buf[2] == `;` {
|
||||
// code = KeyCode(buf[4] + 197)
|
||||
modifiers = match buf[3] {
|
||||
|
Reference in New Issue
Block a user