Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2002 22:33:43 +0800 (CST)
From:      mhsin@mhsin.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/34305: chinese/irssi has some problem displaying a long line
Message-ID:  <200201261433.g0QEXhK28607@mhsin.org>

next in thread | raw e-mail | index | archive | help

>Number:         34305
>Category:       ports
>Synopsis:       chinese/irssi has some problem displaying a long 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:   Sat Jan 26 06:40:00 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 chinese/irssi displays a long line at bottom line of display
	area, will cause the Big5 word at right margin to be broken.

>How-To-Repeat:
	Type a very long line with a Big5 word being placed at right margin,
	a space, and somthing. Like this:
	
	"blah blah blah blah blah B5B5B5B5B5 blah"
	                                   ^ right margin
	
	Will be displayed like
	
	"blah blah blah blah blah B5B5B5B5? "
	"blah"
	
	ps: "B5" denotes a Big5 word
>Fix:

New files/patch-src_fe-text_gui-wrap.c
(Also suggest rename files/patch-src_fe-text_gui-wrap.c to
                     files/patch-src_fe-text_gui-windows.c)

--- src/fe-text/gui-windows.c.orig	Sat Mar 17 07:55:50 2001
+++ src/fe-text/gui-windows.c	Sat Jan 26 19:40:34 2002
@@ -289,6 +289,7 @@
         unsigned char cmd;
 	char *ptr, *last_space_ptr;
 	int xpos, pos, indent_pos, last_space, last_color, color;
+	int w = 0;
 
 	g_return_val_if_fail(line->text != NULL, NULL);
 
@@ -343,14 +344,14 @@
 			continue;
 		}
 
-		if (xpos == COLS && sub != NULL &&
+		if (xpos >= COLS && sub != NULL &&
 		    (last_space <= indent_pos || last_space <= 10)) {
                         /* long word, remove the indentation from this line */
 			xpos -= sub->indent;
                         sub->indent = 0;
 		}
 
-		if (xpos == COLS) {
+		if (xpos >= COLS) {
 			xpos = indent_pos;
 
 			sub = g_new(LINE_CACHE_SUB_REC, 1);
@@ -376,8 +377,25 @@
 			continue;
 		}
 
-		xpos++;
-		if (*ptr++ == ' ') {
+		if(ptr[1] != '\0' && is_big5(ptr[0], ptr[1]))
+			w = 2;
+		else
+			w = 1;
+		
+		xpos+=w;
+		if (*ptr == ' ' ||
+		    (xpos <= COLS && w > 1)) {
+			last_space = xpos-1;
+			last_space_ptr = ptr + w;
+			last_color = color;
+		}
+		if(xpos <= COLS)
+			ptr += w;
+		
+		if(w == 1 && xpos <= COLS &&
+			(ptr[0] == ' ' ||
+			 (ptr[0] != '\0' && ptr[1] != '\0' && is_big5(ptr[0], ptr[1]))))
+		{
 			last_space = xpos-1;
 			last_space_ptr = ptr;
 			last_color = color;
@@ -525,6 +543,9 @@
 		next_pos = (n+1 < cache->count) ?
 			cache->lines[n].start : NULL;
 
+		if(next_pos != NULL && next_pos > pos && *(next_pos - 1) == ' ')
+			while(next_pos > pos && *(next_pos - 1) == ' ')
+				next_pos --;
 		single_line_draw(gui, ypos, sub, pos, next_pos);
 	}
 

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201261433.g0QEXhK28607>