From timon@memphis.mephi.ru  Sun Jan 25 15:06:07 2004
Return-Path: <timon@memphis.mephi.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 570DD16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Jan 2004 15:06:07 -0800 (PST)
Received: from memphis.mephi.ru (memphis.mephi.ru [194.67.67.234])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4989443D49
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Jan 2004 15:06:05 -0800 (PST)
	(envelope-from timon@memphis.mephi.ru)
Received: from memphis.mephi.ru (timon@localhost [127.0.0.1])
	by memphis.mephi.ru (8.12.6p2/8.12.6) with ESMTP id i0PN6357009985
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 26 Jan 2004 02:06:03 +0300 (MSK)
	(envelope-from timon@memphis.mephi.ru)
Received: (from timon@localhost)
	by memphis.mephi.ru (8.12.6p2/8.12.6/Submit) id i0PN62YT009984;
	Mon, 26 Jan 2004 02:06:02 +0300 (MSK)
Message-Id: <200401252306.i0PN62YT009984@memphis.mephi.ru>
Date: Mon, 26 Jan 2004 02:06:02 +0300 (MSK)
From: Artem Ignatiev <timon@memphis.mephi.ru>
Reply-To: Artem Ignatiev <timon@memphis.mephi.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] fix for line wrapping with national symbols in news/pan2
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61911
>Category:       ports
>Synopsis:       [PATCH] fix for line wrapping with national symbols in news/pan2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnome
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 25 15:10:17 PST 2004
>Closed-Date:    Sun Feb 01 23:34:41 PST 2004
>Last-Modified:  Sun Feb 01 23:34:41 PST 2004
>Originator:     Artem Ignatiev
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD timon.nist 5.2-CURRENT FreeBSD 5.2-CURRENT #4: Sun Jan 25 04:09:32 MSK 2004 root@timon.nist:/usr/obj/usr/src/sys/TIMON i386


	
>Description:
	news/pan2 port badly wraps long lines if they contains national symbols (and therefore are internally represented in UTF-8)
	I've reported that bug to Pan developers, and they produced a fix for that problem.
	

>How-To-Repeat:
	Install pan2 and configure it as your newsreader. Try to type in message in national language (eg. Russian). See how it wraps lines around 40-th symbol, which is a half of line. 
	
>Fix:
This is fix from Pan developers (diff between rev 1.4 and 1.3 of file)
	

--- patch-text-massager.c::wrap begins here ---
--- pan/base/text-massager.c.orig	Mon Jan 26 00:51:26 2004
+++ pan/base/text-massager.c	Mon Jan 26 00:55:48 2004
@@ -250,23 +250,29 @@
 	char * pch;
 	char * line_start;
 	char * end;
+	int    pos;
 
 	/* walk through the entire string */
 	linefeed_here = NULL;
-	for (line_start=pch=str->str, end=line_start+str->len; pch!=end; )
+	for (pos = 0, line_start=pch=str->str, end=line_start+str->len; pch<end; )
 	{
 		/* a linefeed could go here; remember this space */
-		if (isspace((guchar)*pch) || *pch=='\n')
+		if (g_unichar_isspace(g_utf8_get_char (pch)) || *pch=='\n')
 			linefeed_here = pch;
 
 		/* line's too long; add a linefeed if we can */
-		if (pch-line_start>=column && linefeed_here!=NULL)
+		if (pos>=column && linefeed_here!=NULL)
 		{
 			*linefeed_here = '\n';
 			pch = line_start = linefeed_here + 1;
 			linefeed_here = NULL;
+			pos = 0;
+		}
+		else 
+		{
+			pch = g_utf8_next_char (pch);
+			++ pos;
 		}
-		else ++pch;
 	}
 }
 
--- patch-text-massager.c::wrap ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->gnome 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Jan 25 19:43:54 PST 2004 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61911 
State-Changed-From-To: open->closed 
State-Changed-By: marcus 
State-Changed-When: Sun Feb 1 23:34:31 PST 2004 
State-Changed-Why:  
Committed, thanks! 

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