summaryrefslogtreecommitdiffstats
path: root/patches/source/screen/52fix_screen_utf8_nfd.patch
blob: 0aa72d5ed00a099cea6ce11d5c30c9678faa6ef8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## 52fix_screen_utf8_nfd.dpatch by Nobuhiro Iwamatsu <iwamatsu@debian.org>
##
## DP: screen outputs screen "ÿ" after a connected character.  
## DP: This is a character without the need. 
## DP: This happens in UTF-8 environment. 
## DP: Before : screen$ ruby1.9.1 -e 'puts "\u304b\u3099.."'
## DP:          がÿ...
## DP: patch applied :  screen $ ruby1.9.1 -e 'puts "\u304b\u3099.."'
## DP:          が..
## DP: Report from  http://d.hatena.ne.jp/mrkn/20101014/fix_screen_utf8_nfd_bug
## DP: Copyright Kenta Murata (mrkn) <mrkn@ruby-lang.org>
## DP: Modified by Nobuhiro Iwamatsu <iwamatsu@debian.org>

Index: screen/ansi.c
===================================================================
--- screen.orig/ansi.c	2012-03-20 22:15:02.000000000 +0100
+++ screen/ansi.c	2012-03-20 22:41:45.000000000 +0100
@@ -725,6 +725,10 @@
 		      LPutChar(&curr->w_layer, &omc, ox, oy);
 		      LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
 		    }
+	          if (curr->w_mbcs)
+		    {
+		      curr->w_rend.mbcs = curr->w_mbcs = 0;
+		    }
 		  break;
 		}
 	      font = curr->w_rend.font;
Index: screen/display.c
===================================================================
--- screen.orig/display.c	2012-03-20 22:41:28.000000000 +0100
+++ screen/display.c	2012-03-20 22:41:45.000000000 +0100
@@ -603,7 +603,7 @@
 	    D_x += D_AM ? 1 : -1;
 	  D_mbcs = 0;
 	}
-      else if (utf8_isdouble(c))
+      else if (utf8_isdouble(c) || (c >= 0xd800 && c < 0xe000))
 	{
 	  D_mbcs = c;
 	  D_x++;