changeset 15761:e0027ebd2300

Cute little mod.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 02 Mar 2007 06:57:53 +0000
parents 01fcef299063
children d318c6672011
files console/libgnt/gnttextview.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gnttextview.c	Fri Mar 02 05:19:44 2007 +0000
+++ b/console/libgnt/gnttextview.c	Fri Mar 02 06:57:53 2007 +0000
@@ -201,16 +201,17 @@
 	}
 
 	lines = g_list_nth(view->list, y - 1);
+	do {
+		line = lines->data;
+		lines = lines->next;
+	} while (line && !line->segments);
 
-	line = lines->data;
-	for (i = y; line && !line->segments; i++)
-		line = g_list_nth_data(lines, i);
 	if (!line) /* no valid line */
 		return NULL;
 	segs = line->segments;
 	seg = (GntTextSegment *)segs->data;
 	i = 0;
-	return view->string->str + seg->start + x;
+	return view->string->str + seg->start + MIN(x, line->length);
 }
 
 static GString *