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

Revert "term: obtain the cursor position via termios.h (#11372)"

This reverts commit af28d09630.
This commit is contained in:
Alexander Medvednikov
2021-09-06 18:21:55 +03:00
parent af28d09630
commit 0376cbf6bd
19 changed files with 129 additions and 196 deletions

View File

@@ -10,18 +10,27 @@ import time
#include <sys/ioctl.h>
#include <signal.h>
fn C.tcgetattr(fd int, termios_p &C.termios) int
fn C.tcsetattr(fd int, optional_actions int, termios_p &C.termios) int
fn C.ioctl(fd int, request u64, arg voidptr) int
struct C.termios {
mut:
c_iflag u32
c_lflag u32
c_cc [32]byte
}
struct C.winsize {
ws_row u16
ws_col u16
}
fn C.tcgetattr(fd int, termios_p &C.termios) int
fn C.tcsetattr(fd int, optional_actions int, const_termios_p &C.termios) int
fn C.ioctl(fd int, request u64, arg voidptr) int
const termios_at_startup = get_termios()
const (
termios_at_startup = get_termios()
)
[inline]
fn get_termios() C.termios {
@@ -65,11 +74,11 @@ fn (mut ctx Context) termios_setup() ? {
if ctx.cfg.capture_events {
// Set raw input mode by unsetting ICANON and ECHO,
// as well as disable e.g. ctrl+c and ctrl.z
termios.c_iflag &= ~(C.IGNBRK | C.BRKINT | C.PARMRK | C.IXON)
termios.c_lflag &= ~(C.ICANON | C.ISIG | C.ECHO | C.IEXTEN | C.TOSTOP)
termios.c_iflag &= ~u32(C.IGNBRK | C.BRKINT | C.PARMRK | C.IXON)
termios.c_lflag &= ~u32(C.ICANON | C.ISIG | C.ECHO | C.IEXTEN | C.TOSTOP)
} else {
// Set raw input mode by unsetting ICANON and ECHO
termios.c_lflag &= ~(C.ICANON | C.ECHO)
termios.c_lflag &= ~u32(C.ICANON | C.ECHO)
}
if ctx.cfg.hide_cursor {