? putty.diff
Index: settings.c
===================================================================
RCS file: /home/cvs/putty/settings.c,v
retrieving revision 1.102
diff -u -r1.102 settings.c
--- settings.c	4 Feb 2003 13:02:50 -0000	1.102
+++ settings.c	24 Feb 2003 21:37:14 -0000
@@ -564,7 +564,7 @@
      * The empty default for LineCodePage will be converted later
      * into a plausible default for the locale.
      */
-    gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
+    gpps(sesskey, "LineCodePage", "CP949", cfg->line_codepage,
 	 sizeof(cfg->line_codepage));
     gpps(sesskey, "Printer", "", cfg->printer, sizeof(cfg->printer));
     gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
Index: terminal.c
===================================================================
RCS file: /home/cvs/putty/terminal.c,v
retrieving revision 1.142
diff -u -r1.142 terminal.c
--- terminal.c	1 Feb 2003 17:24:25 -0000	1.142
+++ terminal.c	24 Feb 2003 21:37:21 -0000
@@ -3117,7 +3117,7 @@
     unsigned long rv, cursor;
     pos scrpos;
     char ch[1024];
-    long cursor_background = ERASE_CHAR;
+    long cursor_background = ERASE_CHAR, cursor_background2 = ERASE_CHAR;
     unsigned long ticks;
 #ifdef OPTIMISE_SCROLL
     struct scrollregion *sr;
@@ -3276,6 +3276,9 @@
 	    if (i == our_curs_y && j == our_curs_x) {
 		cursor_background = tattr | tchar;
 		term->dispcurs = term->disptext + idx;
+	    } else if (cursor_background != ERASE_CHAR &&
+			i == our_curs_y && j == term->curs.x+1) {
+		cursor_background2 = tattr | tchar;
 	    }
 
 	    if ((term->disptext[idx] ^ tattr) & ATTR_WIDE)
@@ -3339,7 +3342,11 @@
 	if (i == our_curs_y && (term->curstype != cursor || updated_line)) {
 	    ch[0] = (char) (cursor_background & CHAR_MASK);
 	    attr = (cursor_background & ATTR_MASK) | cursor;
-	    do_cursor(ctx, our_curs_x, i, ch, 1, attr, lattr);
+	    if ((unsigned char)*ch >= 0x81 && cursor_background2 != ERASE_CHAR) {
+	        ch[1] = (char) (cursor_background2 & CHAR_MASK);
+		do_cursor(ctx, our_curs_x, i, ch, 2, attr, lattr);
+	    } else
+	        do_cursor(ctx, our_curs_x, i, ch, 1, attr, lattr);	    
 	    term->curstype = cursor;
 	}
     }
Index: unicode.c
===================================================================
RCS file: /home/cvs/putty/unicode.c,v
retrieving revision 1.31
diff -u -r1.31 unicode.c
--- unicode.c	15 Jan 2003 16:16:36 -0000	1.31
+++ unicode.c	24 Feb 2003 21:37:23 -0000
@@ -16,6 +16,8 @@
  * the xterm one has the four scanlines that have no unicode 2.0
  * equivalents mapped to their unicode 3.0 locations.
  */
+static char **uni_tbl = NULL;
+
 static const WCHAR unitab_xterm_std[32] = {
     0x2666, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1,
     0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba,
@@ -406,6 +408,9 @@
     {"CP437", 437},
     {"CP819", 28591},
     {"CP878", 20866},
+    {"CP932", 932},
+    {"CP949", 949},
+    {"CP950", 950},
 
     {"Use font encoding", -1},
 
@@ -1086,7 +1091,7 @@
 	    if (GetCPInfo(codepage, &cpinfo) == 0) {
 		codepage = -2;
 	    } else if (cpinfo.MaxCharSize > 1)
-		codepage = -3;
+		/*codepage = -3*/;
 	}
     }
     if (codepage == -1 && *cp_name)
Index: window.c
===================================================================
RCS file: /home/cvs/putty/window.c,v
retrieving revision 1.238
diff -u -r1.238 window.c
--- window.c	1 Feb 2003 12:54:40 -0000	1.238
+++ window.c	24 Feb 2003 21:37:29 -0000
@@ -181,6 +181,9 @@
 
 static UINT wm_mousewheel = WM_MOUSEWHEEL;
 
+static int iic = 0;
+static unsigned char iic_buf[2];
+
 /* Dummy routine, only required in plink. */
 void ldisc_update(void *frontend, int echo, int edit)
 {
@@ -2506,14 +2509,27 @@
 	set_input_locale((HKL)lParam);
 	sys_cursor_update();
 	break;
-      case WM_IME_NOTIFY:
-	if(wParam == IMN_SETOPENSTATUS) {
+      case WM_IME_STARTCOMPOSITION:
+        {
 	    HIMC hImc = ImmGetContext(hwnd);
-	    ImmSetCompositionFont(hImc, &lfont);
+	    COMPOSITIONFORM cf;
+	    RECT rectWorkArea;
+	    SystemParametersInfo(SPI_GETWORKAREA,
+				   0,
+				   (void*)&rectWorkArea,
+				   0);
+
+	    cf.dwStyle = CFS_POINT;
+	    cf.ptCurrentPos.x = 0; // drive out of screen
+	    cf.ptCurrentPos.y = rectWorkArea.bottom+50;
+	    ImmSetCompositionWindow(hImc, &cf);
 	    ImmReleaseContext(hwnd, hImc);
 	    return 0;
 	}
 	break;
+      case WM_IME_ENDCOMPOSITION:
+        iic = 0;
+        break;
       case WM_IME_COMPOSITION:
 	{
 	    HIMC hIMC;
@@ -2521,10 +2537,25 @@
 	    char *buff;
 
 	    if(osVersion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || 
-	        osVersion.dwPlatformId == VER_PLATFORM_WIN32s) break; /* no Unicode */
+	        osVersion.dwPlatformId == VER_PLATFORM_WIN32s) {
+	        break; /* no Unicode */
+	    }
 
-	    if ((lParam & GCS_RESULTSTR) == 0) /* Composition unfinished. */
+	    if ((lParam & GCS_RESULTSTR) == 0) {/* Composition unfinished. */
+		RECT invrect;
+		
+		iic_buf[0] = wParam >> 8;
+		iic_buf[1] = wParam;
+		iic = 2;
+		invrect.left = caret_x;
+		invrect.top  = caret_y;
+		invrect.right = caret_x + 8;  /* this really works (do_paints paints by character. ;) */
+		invrect.bottom = caret_y + 8;
+		InvalidateRect(hwnd, &invrect, TRUE);
 		break; /* fall back to DefWindowProc */
+	    }
+
+	    iic = 0;
 
 	    hIMC = ImmGetContext(hwnd);
 	    n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
@@ -2667,8 +2698,10 @@
 
 static void sys_cursor_update(void)
 {
+#if 0
     COMPOSITIONFORM cf;
     HIMC hIMC;
+#endif
 
     if (!term->has_focus) return;
 
@@ -2683,6 +2716,7 @@
     if(osVersion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
 	    osVersion.dwMinorVersion == 0) return; /* 95 */
 
+#if 0
     /* we should have the IMM functions */
     hIMC = ImmGetContext(hwnd);
     cf.dwStyle = CFS_POINT;
@@ -2691,6 +2725,7 @@
     ImmSetCompositionWindow(hIMC, &cf);
 
     ImmReleaseContext(hwnd, hIMC);
+#endif
 }
 
 /*
@@ -2856,7 +2891,7 @@
 	for(nlen = mptr = 0; mptr<len; mptr++) {
 	    uni_buf[nlen] = 0xFFFD;
 	    if (IsDBCSLeadByteEx(ucsdata.font_codepage, (BYTE) text[mptr])) {
-		IpDx[nlen] += char_width;
+		if (font_dualwidth) IpDx[nlen] += char_width;
 	        MultiByteToWideChar(ucsdata.font_codepage, MB_USEGLYPHCHARS,
 				   text+mptr, 2, uni_buf+nlen, 1);
 		mptr++;
@@ -2955,7 +2990,17 @@
 
     if ((attr & TATTR_ACTCURS) && (ctype == 0 || term->big_cursor)) {
 	if (((attr & CSET_MASK) | (unsigned char) *text) != UCSWIDE) {
+	    int xx, yy;
 	    do_text(ctx, x, y, text, len, attr, lattr);
+	    fnt_width = char_width = font_width * (1 + (lattr != LATTR_NORM));
+	    if (attr & ATTR_WIDE) char_width *= 2;
+	    xx = x * fnt_width;
+	    yy = y * font_height;
+	    xx += offset_width;
+	    yy += offset_height;
+	    if (iic) {
+		ExtTextOut(hdc, xx, yy, ETO_CLIPPED | ETO_OPAQUE, 0, iic_buf, 2, 0);
+	    }
 	    return;
 	}
 	ctype = 2;
@@ -3017,6 +3062,9 @@
 	    }
 	}
     }
+    if (iic) {
+	ExtTextOut(hdc, x, y, ETO_CLIPPED | ETO_OPAQUE, 0, iic_buf, 2, 0);
+    }
 }
 
 /* This function gets the actual width of a character in the normal font.
@@ -3784,6 +3832,9 @@
 	}
 
 	r = ToAsciiEx(wParam, scan, keystate, keys, 0, kbd_layout);
+        /* Workaround for Hangul Windows 98 */
+        if (r == 0 && keys[0] == '\0')
+            r = ToAscii(wParam, scan, keystate, keys, 0);
 #ifdef SHOW_TOASCII_RESULT
 	if (r == 1 && !key_down) {
 	    if (alt_sum) {
