From owner-freebsd-ports Sun Jan 27 9:40:21 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 27D0C37B425 for ; Sun, 27 Jan 2002 09:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0RHe1A71064; Sun, 27 Jan 2002 09:40:01 -0800 (PST) (envelope-from gnats) Received: from mhsin.org (mhsin.m7.ntu.edu.tw [140.112.249.69]) by hub.freebsd.org (Postfix) with ESMTP id 8793837B48C for ; Sun, 27 Jan 2002 09:35:45 -0800 (PST) Received: (from mhsin@localhost) by mhsin.org (8.11.3/8.11.3) id g0RHZP630706; Mon, 28 Jan 2002 01:35:25 +0800 (CST) (envelope-from mhsin) Message-Id: <200201271735.g0RHZP630706@mhsin.org> Date: Mon, 28 Jan 2002 01:35:25 +0800 (CST) From: mhsin@mhsin.org Reply-To: mhsin@mhsin.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/34343: chinese/irssi will crash when ^K at beginning of line Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 34343 >Category: ports >Synopsis: chinese/irssi will crash when ^K at beginning of line >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 27 09:40:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Michael Hsin >Release: FreeBSD 4.3-RELEASE i386 >Organization: >Environment: System: FreeBSD mhsin.org 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Sat Jun 9 19:54:25 CST 2001 root@mhsin.org:/usr/src/sys/compile/mhsin i386 >Description: When use ^K (erase to end of line) at beginning of a line which has a Big5 word at beginning, chinese/irssi will invoke an assertion error. >How-To-Repeat: Run chinese/irssi, type a Big5 word, move to beginning of line, then press ^K to erase whole line. >Fix: New files/patch_src_fe-text_gui-entry.c (Also add a variable in settings to control Big5 style cursor movement. "fe-text" = { big5_cursor_movement = "yes"; }; ) --- src/fe-text/gui-entry.c.orig Sun Mar 4 02:04:10 2001 +++ src/fe-text/gui-entry.c Sat Jan 26 20:38:19 2002 @@ -29,6 +29,28 @@ static int prompt_hidden; static char *prompt; +#ifdef WANT_BIG5 +#include "settings.h" + +int gui_is_big5(char *str, int pos) +{ + int a; + + if(pos < 0) + return 0; + for(a = 0; a < pos;) + { + if(str[0] == '\0') + break; + if(is_big5(str[a], str[a + 1])) + a += 2; + else + a ++; + } + return ((a == pos) && is_big5(str[a], str[a + 1])); +} +#endif WANT_BIG5 + static void entry_screenpos(void) { if (pos-scrstart < COLS-2-promptlen && pos-scrstart > 0) { @@ -42,6 +64,14 @@ } else { scrpos = (COLS-promptlen)*2/3; scrstart = pos-scrpos; +#ifdef WANT_BIG5 + if((scrstart > 0) && + gui_is_big5(entry->str, scrstart - 1)) + { + scrstart --; + scrpos ++; + } +#endif WANT_BIG5 } } @@ -152,6 +182,12 @@ { if (pos < size) return; +#ifdef WANT_BIG5 + if (settings_get_bool("big5_cursor_movement")) + if(size == 1 && gui_is_big5(entry->str, pos - 2)) + size++; +#endif WANT_BIG5 + pos -= size; g_string_erase(entry, pos, size); @@ -217,6 +253,16 @@ void gui_entry_move_pos(int p) { +#ifdef WANT_BIG5 + if(settings_get_bool("big5_cursor_movement")) + { + if (p == 1 && gui_is_big5(entry->str, pos)) + p++; + else if (p == -1 && gui_is_big5(entry->str, pos - 2)) + p--; + } +#endif WANT_BIG5 + if (pos+p >= 0 && pos+p <= entry->len) pos += p; @@ -277,6 +323,9 @@ prompt = NULL; promptlen = 0; permanent_prompt = FALSE; prompt_hidden = FALSE; +#ifdef WANT_BIG5 + settings_add_bool("fe-text", "big5_cursor_movement", FALSE); +#endif WANT_BIG5 } void gui_entry_deinit(void) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message