Only unset ICANON and ECHO instead of whole raw mode - sacc - sacc(omys), simple console gopher client
HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR LICENSE
---
DIR commit 1b724721acb63d32ea730b80348b7d96a27bbe09
DIR parent 5a23f2a6c54c154c997cf70eafecae6e90827ab5
HTML Author: Quentin Rameau <quinq@fifth.space>
Date: Mon, 10 Jul 2017 15:03:41 +0200
Only unset ICANON and ECHO instead of whole raw mode
Diffstat:
M ui_ti.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
DIR diff --git a/ui_ti.c b/ui_ti.c
@@ -26,21 +26,23 @@ uisetup(void)
struct termios traw;
tcgetattr(0, &tsave);
- traw = tsave;
- cfmakeraw(&traw);
- tcsetattr(0, TCSAFLUSH, &traw);
+ tsacc = tsave;
+ tsacc.c_lflag &= ~(ECHO|ICANON);
+ tcsetattr(0, TCSANOW, &tsacc);
setupterm(NULL, 1, NULL);
putp(tparm(save_cursor));
putp(tparm(change_scroll_region, 0, lines-2));
putp(tparm(restore_cursor));
+ fflush(stdout);
}
void
uicleanup(void)
{
- tcsetattr(0, TCSAFLUSH, &tsave);
+ putp(tparm(change_scroll_region, 0, lines-1));
putp(tparm(clear_screen));
+ tcsetattr(0, TCSANOW, &tsave);
fflush(stdout);
}
@@ -72,6 +74,7 @@ displaystatus(Item *item)
putp(tparm(exit_standout_mode));
putp(tparm(restore_cursor));
+ fflush(stdout);
}
void