From f5c4671bfbad96bf346bd7e9a21fc4317b4959df Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 3 Dec 2022 17:00:20 +0530 Subject: Adds most of the tools --- v_windows/v/vlib/readline/readline.v | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 v_windows/v/vlib/readline/readline.v (limited to 'v_windows/v/vlib/readline/readline.v') diff --git a/v_windows/v/vlib/readline/readline.v b/v_windows/v/vlib/readline/readline.v new file mode 100644 index 0000000..4f0ebf7 --- /dev/null +++ b/v_windows/v/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 +} -- cgit v1.2.3