Commit 94ec8cff authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

remove unused call to get_last_line()

2000-12-14  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
	unused call to get_last_line()

	* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
	here until boxed is working (and maybe after that - we should
	really not gratuitously break old code)

	* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
	specific types for font_desc and tabs args, move them to
	GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
	fixed. Move GdkColor args to GTK_TYPE_POINTER also.

	* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
	use GTK_TYPE_POINTER for signal signatures as a hack-around

	* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
	PangoTabArray

	* gtk/gtktextlayout.c (line_display_iter_to_index):
	make static
	(line_display_index_to_iter): make static

	* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
	to marshal a string not a boxed

	* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text

	* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
	since the UTF-8 isn't validated yet

	* gtk/gtktextsegment.c (char_segment_check_func): don't require
	lines to end in '\n'

	* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
	forward_to_delimiters, and grapheme boundaries
	(gtk_text_view_delete_from_cursor): properly handle non-newline
	delimiters, and grapheme boundaries

	* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
	to gtk_text_iter_forward_to_delimiters, and make it work properly
	if empty lines end with a character other than '\n'

	* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
	position
parent 2e70f892
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_validate_line): remove
unused call to get_last_line()
* gtk/gtkobject.c (gtk_object_add_arg_type): add G_TYPE_POINTER
here until boxed is working (and maybe after that - we should
really not gratuitously break old code)
* gtk/gtktexttag.c (gtk_text_tag_class_init): add commented-out
specific types for font_desc and tabs args, move them to
GTK_TYPE_POINTER for now, waiting on g_param_spec_boxed() to get
fixed. Move GdkColor args to GTK_TYPE_POINTER also.
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): temporarily
use GTK_TYPE_POINTER for signal signatures as a hack-around
* gtk/gtk-boxed.defs: Add boxed types for PangoFontDescription and
PangoTabArray
* gtk/gtktextlayout.c (line_display_iter_to_index):
make static
(line_display_index_to_iter): make static
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
to marshal a string not a boxed
* gtk/gtkmarshal.list: add marshaller for GtkTextBuffer:insert_text
* gtk/testtext.c (fill_file_buffer): don't use g_utf8_next_char
since the UTF-8 isn't validated yet
* gtk/gtktextsegment.c (char_segment_check_func): don't require
lines to end in '\n'
* gtk/gtktextview.c (gtk_text_view_move_cursor): update to use
forward_to_delimiters, and grapheme boundaries
(gtk_text_view_delete_from_cursor): properly handle non-newline
delimiters, and grapheme boundaries
* gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): rename
to gtk_text_iter_forward_to_delimiters, and make it work properly
if empty lines end with a character other than '\n'
* gtk/gtktextiter.h, gtk/gtktextiter.c: Add movement by cursor
position
2000-12-15 Tor Lillqvist <tml@iki.fi>
* gdk/makefile.{mingw.in,msc} (gdk_OBJECTS): Add gdkkeys.
......@@ -37,7 +84,7 @@
* gtk/gtktext*.[hc]: update to reflect renamed btree functions
2000-12-13 <alexl@redhat.com>
2000-12-13 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkmouse-fb.c (mouse_devs):
Add support for ps2 intellimouse.
......
......@@ -1286,6 +1286,14 @@
gtk_text_iter_copy
gtk_text_iter_free)
(define-boxed PangoTabArray
pango_tab_array_copy
pango_tab_array_free)
(define-boxed PangoFontDescription
pango_font_description_copy
pango_font_description_free)
;; TreeView
(define-boxed GtkTreeIter
gtk_tree_iter_copy
......
......@@ -47,7 +47,7 @@ VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,BOXED
VOID:BOXED,BOXED,BOOLEAN
VOID:BOXED,BOXED,INT,BOOLEAN
VOID:BOXED,STRING,INT,BOOLEAN
VOID:BOXED,INT,POINTER
VOID:BOXED,OBJECT
VOID:BOXED,UINT,FLAGS
......
......@@ -47,7 +47,7 @@ VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,BOXED
VOID:BOXED,BOXED,BOOLEAN
VOID:BOXED,BOXED,INT,BOOLEAN
VOID:BOXED,STRING,INT,BOOLEAN
VOID:BOXED,INT,POINTER
VOID:BOXED,OBJECT
VOID:BOXED,UINT,FLAGS
......
......@@ -290,6 +290,9 @@ gtk_object_add_arg_type (const gchar *arg_name,
case G_TYPE_STRING:
pspec = g_param_spec_string (pname, NULL, NULL, NULL, arg_flags);
break;
case G_TYPE_POINTER:
pspec = g_param_spec_pointer (pname, NULL, NULL, arg_flags);
break;
case G_TYPE_OBJECT:
pspec = g_param_spec_object (pname, NULL, NULL, arg_type, arg_flags);
break;
......
......@@ -959,6 +959,8 @@ _gtk_text_btree_insert (GtkTextIter *iter,
chars_changed (tree);
segments_changed (tree);
g_assert (g_utf8_validate (text, len, NULL));
/*
* Chop the text up into lines and create a new segment for
* each line, plus a new line for the leftovers from the
......@@ -971,6 +973,8 @@ _gtk_text_btree_insert (GtkTextIter *iter,
char_count_delta = 0;
while (eol < len)
{
sol = eol;
pango_find_paragraph_boundary (text + sol,
len - sol,
&delim,
......@@ -979,9 +983,16 @@ _gtk_text_btree_insert (GtkTextIter *iter,
/* make these relative to the start of the text */
delim += sol;
eol += sol;
g_assert (eol >= sol);
g_assert (delim >= sol);
g_assert (eol >= delim);
g_assert (sol >= 0);
g_assert (eol <= len);
chunk_len = eol - sol;
g_assert (g_utf8_validate (&text[sol], chunk_len, NULL));
seg = _gtk_char_segment_new (&text[sol], chunk_len);
char_count_delta += seg->char_count;
......@@ -998,8 +1009,11 @@ _gtk_text_btree_insert (GtkTextIter *iter,
}
if (delim == eol)
/* chunk didn't end with a paragraph separator */
break;
{
/* chunk didn't end with a paragraph separator */
g_assert (eol == len);
break;
}
/*
* The chunk ended with a newline, so create a new GtkTextLine
......@@ -1015,8 +1029,6 @@ _gtk_text_btree_insert (GtkTextIter *iter,
line = newline;
cur_seg = NULL;
line_count_delta++;
sol = eol;
}
/*
......@@ -1215,9 +1227,9 @@ find_line_by_y (GtkTextBTree *tree, BTreeView *view,
GtkTextLine *
_gtk_text_btree_find_line_by_y (GtkTextBTree *tree,
gpointer view_id,
gint ypixel,
gint *line_top_out)
gpointer view_id,
gint ypixel,
gint *line_top_out)
{
GtkTextLine *line;
BTreeView *view;
......@@ -3240,7 +3252,7 @@ _gtk_text_line_get_data (GtkTextLine *line,
void
_gtk_text_line_invalidate_wrap (GtkTextLine *line,
GtkTextLineData *ld)
GtkTextLineData *ld)
{
/* For now this is totally unoptimized. FIXME?
......@@ -3248,9 +3260,9 @@ _gtk_text_line_invalidate_wrap (GtkTextLine *line,
is less than the max width for the parent node,
and the case where the height is unchanged when we re-wrap.
*/
g_return_if_fail (ld != NULL);
ld->valid = FALSE;
gtk_text_btree_node_invalidate_upward (line->parent, ld->view_id);
}
......@@ -4997,11 +5009,10 @@ gtk_text_btree_node_check_valid_downward (GtkTextBTreeNode *node,
**/
void
_gtk_text_btree_validate_line (GtkTextBTree *tree,
GtkTextLine *line,
gpointer view_id)
GtkTextLine *line,
gpointer view_id)
{
GtkTextLineData *ld;
GtkTextLine *last_line;
BTreeView *view;
g_return_if_fail (tree != NULL);
......@@ -5009,13 +5020,12 @@ _gtk_text_btree_validate_line (GtkTextBTree *tree,
view = gtk_text_btree_get_view (tree, view_id);
g_return_if_fail (view != NULL);
ld = _gtk_text_line_get_data (line, view_id);
if (!ld || !ld->valid)
{
ld = gtk_text_layout_wrap (view->layout, line, ld);
last_line = get_last_line (tree);
gtk_text_btree_node_check_valid_upward (line->parent, view_id);
}
}
......
......@@ -148,11 +148,16 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTextBufferClass, insert_text),
gtk_marshal_VOID__BOXED_BOXED_INT_BOOLEAN,
gtk_marshal_VOID__BOXED_STRING_INT_BOOLEAN,
GTK_TYPE_NONE,
4,
#if 0
/* FIXME */
GTK_TYPE_TEXT_ITER,
GTK_TYPE_TEXT_ITER,
GTK_TYPE_STRING,
#endif
GTK_TYPE_POINTER,
GTK_TYPE_POINTER,
GTK_TYPE_INT,
GTK_TYPE_BOOL);
......@@ -164,8 +169,13 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
gtk_marshal_VOID__BOXED_BOXED_BOOLEAN,
GTK_TYPE_NONE,
3,
#if 0
/* FIXME */
GTK_TYPE_TEXT_ITER,
GTK_TYPE_TEXT_ITER,
#endif
GTK_TYPE_POINTER,
GTK_TYPE_POINTER,
GTK_TYPE_BOOL);
signals[CHANGED] =
......@@ -410,10 +420,10 @@ gtk_text_buffer_real_insert_text (GtkTextBuffer *buffer,
static void
gtk_text_buffer_emit_insert (GtkTextBuffer *buffer,
GtkTextIter *iter,
const gchar *text,
gint len,
gboolean interactive)
GtkTextIter *iter,
const gchar *text,
gint len,
gboolean interactive)
{
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
g_return_if_fail (iter != NULL);
......@@ -422,6 +432,8 @@ gtk_text_buffer_emit_insert (GtkTextBuffer *buffer,
if (len < 0)
len = strlen (text);
g_assert (g_utf8_validate (text, len, NULL));
if (len > 0)
{
gtk_signal_emit (GTK_OBJECT (buffer), signals[INSERT_TEXT],
......
......@@ -2606,6 +2606,94 @@ gtk_text_iter_inside_word (const GtkTextIter *iter)
return test_log_attrs (iter, inside_word_func, NULL);
}
static gboolean
find_cursor_pos_func (const PangoLogAttr *attrs,
gint offset,
gint min_offset,
gint len,
gint *found_offset)
{
++offset; /* We always go to the NEXT position */
/* Find end of next word */
while (offset < min_offset + len &&
!attrs[offset].is_cursor_position)
++offset;
*found_offset = offset;
return offset < min_offset + len;
}
static gboolean
is_cursor_pos_func (const PangoLogAttr *attrs,
gint offset,
gint min_offset,
gint len,
gint *found_offset)
{
return attrs[offset].is_cursor_position;
}
gboolean
gtk_text_iter_forward_cursor_position (GtkTextIter *iter)
{
return find_by_log_attrs (iter, find_cursor_pos_func, TRUE);
}
gboolean
gtk_text_iter_backward_cursor_position (GtkTextIter *iter)
{
return find_by_log_attrs (iter, find_cursor_pos_func, FALSE);
}
gboolean
gtk_text_iter_forward_cursor_positions (GtkTextIter *iter,
gint count)
{
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (count > 0, FALSE);
if (!gtk_text_iter_forward_cursor_position (iter))
return FALSE;
--count;
while (count > 0)
{
if (!gtk_text_iter_forward_cursor_position (iter))
break;
--count;
}
return TRUE;
}
gboolean
gtk_text_iter_backward_cursor_positions (GtkTextIter *iter,
gint count)
{
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (count > 0, FALSE);
if (!gtk_text_iter_backward_cursor_position (iter))
return FALSE;
--count;
while (count > 0)
{
if (!gtk_text_iter_backward_cursor_position (iter))
break;
--count;
}
return TRUE;
}
gboolean
gtk_text_iter_is_cursor_position (const GtkTextIter *iter)
{
return test_log_attrs (iter, is_cursor_pos_func, NULL);
}
void
gtk_text_iter_set_line_offset (GtkTextIter *iter,
gint char_on_line)
......@@ -2732,8 +2820,19 @@ gtk_text_iter_forward_to_end (GtkTextIter *iter)
gtk_text_buffer_get_last_iter (buffer, iter);
}
/**
* gtk_text_iter_forward_to_delimiters:
* @iter: a #GtkTextIter
*
* Moves the iterator to point to the paragraph delimiter characters,
* which will be either a newline, a carriage return, a carriage
* return/newline in sequence, or the Unicode paragraph separator
* character.
*
* Return value: %TRUE if we moved and the new location is not the end iterator
**/
gboolean
gtk_text_iter_forward_to_newline (GtkTextIter *iter)
gtk_text_iter_forward_to_delimiters (GtkTextIter *iter)
{
gint current_offset;
gint new_offset;
......@@ -2757,8 +2856,8 @@ gtk_text_iter_forward_to_newline (GtkTextIter *iter)
/* We don't want to move past all
* empty lines.
*/
if (gtk_text_iter_get_char (iter) != '\n')
gtk_text_iter_forward_to_newline (iter);
if (!gtk_text_iter_ends_line (iter))
gtk_text_iter_forward_to_delimiters (iter);
return TRUE;
}
else
......
......@@ -125,11 +125,12 @@ GSList *gtk_text_iter_get_tags (const GtkTextIter *iter);
gboolean gtk_text_iter_editable (const GtkTextIter *iter,
gboolean default_setting);
gboolean gtk_text_iter_starts_word (const GtkTextIter *iter);
gboolean gtk_text_iter_ends_word (const GtkTextIter *iter);
gboolean gtk_text_iter_inside_word (const GtkTextIter *iter);
gboolean gtk_text_iter_starts_line (const GtkTextIter *iter);