blob: 4f0ebf7c403e58a5892b93e2067461084b013e0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
// Serves as a more advanced input method
// based on the work of https://github.com/AmokHuginnsson/replxx
//
module readline
// Termios stores the terminal options on Linux.
struct C.termios {}
struct Termios {
mut:
c_iflag int
c_oflag int
c_cflag int
c_lflag int
c_cc [12]int // NCCS == 12. Can't use the defined value here
}
// Winsize stores the screen information on Linux.
struct Winsize {
ws_row u16
ws_col u16
ws_xpixel u16
ws_ypixel u16
}
// Readline is the key struct for reading and holding user input via a terminal.
// Example: import readline { Readline }
pub struct Readline {
mut:
is_raw bool
orig_termios Termios // Linux
current []rune // Line being edited
cursor int // Cursor position
overwrite bool
cursor_row_offset int
prompt string
prompt_offset int
previous_lines [][]rune
search_index int
is_tty bool
}
|