aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/readline/readline.v
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/old/vlib/readline/readline.v
downloadcli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'v_windows/v/old/vlib/readline/readline.v')
-rw-r--r--v_windows/v/old/vlib/readline/readline.v45
1 files changed, 45 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/readline/readline.v b/v_windows/v/old/vlib/readline/readline.v
new file mode 100644
index 0000000..4f0ebf7
--- /dev/null
+++ b/v_windows/v/old/vlib/readline/readline.v
@@ -0,0 +1,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
+}