* fhandler.h (fhandler_console::trunc_buf): Add to use as cache for
truncated multibyte characters on input. (fhandler_console::write_replacement_char): Declare new method. * fhandler_console.cc (CONVERT_LIMIT): Raise to 64K. (fhandler_console::fhandler_console): Initialize trunc_buf. (ERR): Define as independent value again. (fhandler_console::write_replacement_char): New method to print replacement chars. (fhandler_console::write_normal): Add handling for truncated multibyte sequences. Call next_char instead of pathetic CharNextExA function. Don't change src, rather just work with found later on. * miscfuncs.cc (is_cp_multibyte): Move here from strfuncs.cc. Don't call Windows function, restrict to well-known ANSI/OEM codepages and UTF-8. (next_char): Call CharNextExA only for doublebyte codepages. Implement for UTF-8 here. * strfuncs.cc (is_cp_multibyte): Move to miscfuncs.cc. * winsup.h (next_char): Declare. * include/limits.h (MB_LEN_MAX): Set to maximum value of MB_CUR_MAX as defined by newlib for now.
This commit is contained in:
		| @@ -896,6 +896,13 @@ class fhandler_console: public fhandler_termios | ||||
|   static dev_console *dev_state; | ||||
|   static bool invisible_console; | ||||
|  | ||||
|   /* Used when we encounter a truncated multi-byte sequence.  The | ||||
|      lead bytes are stored here and revisited in the next write call. */ | ||||
|   struct { | ||||
|     int len; | ||||
|     unsigned char buf[4]; /* Max len of valid UTF-8 sequence. */ | ||||
|   } trunc_buf; | ||||
|  | ||||
| /* Output calls */ | ||||
|   void set_default_attr (); | ||||
|  | ||||
| @@ -904,6 +911,7 @@ class fhandler_console: public fhandler_termios | ||||
|   void cursor_set (bool, int, int); | ||||
|   void cursor_get (int *, int *); | ||||
|   void cursor_rel (int, int); | ||||
|   void write_replacement_char (const unsigned char *); | ||||
|   const unsigned char *write_normal (unsigned const char*, unsigned const char *); | ||||
|   void char_command (char); | ||||
|   bool set_raw_win32_keyboard_mode (bool); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user