rline: downstream locale fixes
This commit is contained in:
parent
3a6fc09427
commit
0e031e7908
16
lib/rline.c
16
lib/rline.c
@ -560,7 +560,7 @@ static char * syn_krk_types[] = {
|
||||
"self", "super", /* implicit in a class method */
|
||||
"len", "str", "int", "float", "dir", "repr", /* global functions from __builtins__ */
|
||||
"list","dict","range", /* builtin classes */
|
||||
"object","exception","isinstance","type","tuple","reversed",
|
||||
"object","isinstance","type","tuple","reversed",
|
||||
"print","set","any","all","bool","ord","chr","hex","oct","filter",
|
||||
"sorted","bytes","getattr","sum","min","max","id","hash","map","bin",
|
||||
"enumerate","zip","setattr","property","staticmethod","classmethod",
|
||||
@ -2011,15 +2011,14 @@ static int handle_escape(int * this_buf, int * timeout, int c) {
|
||||
#ifndef _WIN32
|
||||
static unsigned int _INTR, _EOF;
|
||||
static struct termios old;
|
||||
static void get_initial_termios(void) {
|
||||
static void set_unbuffered(void) {
|
||||
tcgetattr(STDOUT_FILENO, &old);
|
||||
_INTR = old.c_cc[VINTR];
|
||||
_EOF = old.c_cc[VEOF];
|
||||
}
|
||||
static void set_unbuffered(void) {
|
||||
struct termios new = old;
|
||||
new.c_lflag &= (~ICANON & ~ECHO & ~ISIG);
|
||||
tcsetattr(STDOUT_FILENO, TCSAFLUSH, &new);
|
||||
if (wcwidth(0x3042) != 2) setlocale(LC_CTYPE, "");
|
||||
}
|
||||
|
||||
static void set_buffered(void) {
|
||||
@ -2028,12 +2027,11 @@ static void set_buffered(void) {
|
||||
#else
|
||||
static unsigned int _INTR = 3;
|
||||
static unsigned int _EOF = 4;
|
||||
static void get_initial_termios(void) {
|
||||
}
|
||||
static void set_unbuffered(void) {
|
||||
/* Disables line input, echo, ^C processing, and a few others. */
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_VIRTUAL_TERMINAL_INPUT);
|
||||
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||
setlocale(LC_CTYPE, "C.UTF-8");
|
||||
}
|
||||
static void set_buffered(void) {
|
||||
/* These are the defaults */
|
||||
@ -2429,12 +2427,6 @@ static int read_line(void) {
|
||||
* Read a line of text with interactive editing.
|
||||
*/
|
||||
int rline(char * buffer, int buf_size) {
|
||||
#ifndef _WIN32
|
||||
setlocale(LC_ALL, "");
|
||||
#else
|
||||
setlocale(LC_ALL, "C.UTF-8");
|
||||
#endif
|
||||
get_initial_termios();
|
||||
set_unbuffered();
|
||||
get_size();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user