From mhsin@mhsin.org  Thu Mar 27 14:07:43 2003
Return-Path: <mhsin@mhsin.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A6AFE37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Mar 2003 14:07:43 -0800 (PST)
Received: from Ada.mhsin.org (mhsin.csie.ntu.edu.tw [140.112.31.59])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6865043FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Mar 2003 14:07:42 -0800 (PST)
	(envelope-from mhsin@mhsin.org)
Received: by Ada.mhsin.org (Postfix, from userid 1701)
	id 5A1EFFEDE; Fri, 28 Mar 2003 06:07:40 +0800 (CST)
Message-Id: <20030327220740.5A1EFFEDE@Ada.mhsin.org>
Date: Fri, 28 Mar 2003 06:07:40 +0800 (CST)
From: Michael Hsin <mhsin@mhsin.org>
Reply-To: Michael Hsin <mhsin@mhsin.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] chinese/irssi readline display error in Big5 terminal
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         50374
>Category:       ports
>Synopsis:       [PATCH] chinese/irssi readline display error in Big5 terminal
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    vanilla
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 27 14:10:07 PST 2003
>Closed-Date:    Mon Mar 31 18:04:20 PST 2003
>Last-Modified:  Mon Mar 31 18:04:20 PST 2003
>Originator:     Michael Hsin
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
NTU CSIE
>Environment:
System: FreeBSD a.mhsin.org 4.6-STABLE FreeBSD 4.6-STABLE #3: Sat Mar 8 23:05:37 CST 2003 root@Ada.mhsin.org:/usr/obj/usr/src/sys/fake i386


>Description:

	chinese/irssi's readline routines read and display strings one character
	a time. This cause display problem in a real Big5 terminal (for example, 
	misc/screen with ^A :encoding big5 big5). 

>How-To-Repeat:

	Install and run misc/screen, type ^A and ":encoding big5 big5" to set
	the encoding of screen. Then start chinese/irssi, key in some Chinese
	words. Screen will "eat" higher bytes of Big5 characters. Pressing ^L
	to redraw screen will correct the output. 
>Fix:

	The patch below: 

--- src/fe-text/gui-readline.c.orig	Mon Nov 11 15:00:02 2002
+++ src/fe-text/gui-readline.c	Fri Mar 28 02:24:38 2003
@@ -50,6 +50,10 @@
 static ENTRY_REDIRECT_REC *redir;
 static int escape_next_key;
 
+static int big5high = FALSE;
+static unichar prekey = '\0';
+
+
 static int readtag;
 static time_t idle_time;
 
@@ -148,7 +152,25 @@
 
 	idle_time = time(NULL);
 
-	if (key < 32) {
+        if(big5high || is_big5_hi(key))
+        {
+          if(big5high)
+          {
+            big5high = FALSE;
+            str[0] = prekey;
+            str[1] = key;
+            str[2] = '\0';
+            gui_entry_insert_text(active_entry, str);
+            return;
+          }
+          else
+          {
+            big5high = TRUE;
+            prekey = key;
+            return;
+          }
+        }
+	else if (key < 32) {
 		/* control key */
                 str[0] = '^';
 		str[1] = (char)key+'@';

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->vanilla 
Responsible-Changed-By: leeym 
Responsible-Changed-When: Mon Mar 31 16:56:52 PST 2003 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50374 
State-Changed-From-To: open->closed 
State-Changed-By: vanilla 
State-Changed-When: Mon Mar 31 18:04:07 PST 2003 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50374 
>Unformatted:
