]> git.lizzy.rs Git - linenoise.git/commitdiff
Add support for utf16 surrogate pairs on Windows
authorSteve Bennett <steveb@workware.net.au>
Fri, 5 Jan 2018 02:22:35 +0000 (12:22 +1000)
committerSteve Bennett <steveb@workware.net.au>
Thu, 15 Feb 2018 01:43:37 +0000 (11:43 +1000)
Signed-off-by: Steve Bennett <steveb@workware.net.au>
linenoise.c

index 9b0d258d8bffe43067693347cc4dd69a362adc00..d04ec6ce31ceef271f9b12b353c324b4e945db69 100644 (file)
@@ -192,7 +192,8 @@ struct current {
     int x;      /* Current column during output */
     int y;      /* Current row */
 #ifdef USE_UTF8
-    WORD ubuf[132];  /* Accumulates utf16 output */
+    #define UBUF_MAX_CHARS 132
+    WORD ubuf[UBUF_MAX_CHARS + 1];  /* Accumulates utf16 output - one extra for final surrogate pairs */
     int ubuflen;      /* length used in ubuf */
     int ubufcols;     /* how many columns are represented by the chars in ubuf? */
 #endif