fix this to be sane
2000-12-04 Havoc Pennington <hp@redhat.com> * gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane * gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler * gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler * gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary hack to avoid infinite loops (queue draw instead of draw) - Owen has more appropriate fixes in a branch he'll check in later. * gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph separator, CR, and CRLF as line ends * gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break into lines using pango_find_paragraph_boundary(); other bits of the widget are still going to be broken if the boundary isn't '\n' though
This commit is contained in:
committed by
Havoc Pennington
parent
d77144614b
commit
9365d0d7dc
@ -1326,18 +1326,49 @@ gtk_text_iter_starts_line (const GtkTextIter *iter)
|
||||
* gtk_text_iter_ends_line:
|
||||
* @iter: an iterator
|
||||
*
|
||||
* Returns TRUE if @iter points to a newline character.
|
||||
* Returns TRUE if @iter points to the start of the paragraph delimiter
|
||||
* characters for a line (delimiters will be either a newline, a
|
||||
* carriage return, a carriage return followed by a newline, or a
|
||||
* Unicode paragraph separator character). Note that an iterator pointing
|
||||
* to the \n of a \r\n pair will not be counted as the end of a line,
|
||||
* the line ends before the \r.
|
||||
*
|
||||
* Return value: whether @iter is at the end of a line
|
||||
**/
|
||||
gboolean
|
||||
gtk_text_iter_ends_line (const GtkTextIter *iter)
|
||||
{
|
||||
GtkTextRealIter *real;
|
||||
gunichar wc;
|
||||
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
real = gtk_text_iter_make_real (iter);
|
||||
|
||||
check_invariants (iter);
|
||||
|
||||
return gtk_text_iter_get_char (iter) == '\n';
|
||||
/* Only one character has type G_UNICODE_PARAGRAPH_SEPARATOR in
|
||||
* Unicode 3.0; update this if that changes.
|
||||
*/
|
||||
#define PARAGRAPH_SEPARATOR 0x2029
|
||||
|
||||
wc = gtk_text_iter_get_char (iter);
|
||||
|
||||
if (wc == '\r' || wc == PARAGRAPH_SEPARATOR)
|
||||
return TRUE;
|
||||
else if (wc == '\n')
|
||||
{
|
||||
/* need to determine if a \r precedes the \n, in which case
|
||||
* we aren't the end of the line
|
||||
*/
|
||||
GtkTextIter tmp = *iter;
|
||||
if (!gtk_text_iter_prev_char (&tmp))
|
||||
return FALSE;
|
||||
|
||||
return gtk_text_iter_get_char (&tmp) != '\r';
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user