GNOME Bugzilla – Bug 727908
Various GtkTextView improvements (doc, unit tests)
Last modified: 2014-04-13 21:09:11 UTC
Various GtkTextView improvements, see the attached patches.
Created attachment 273922 [details] [review] tests textiter: test word boundaries - As the tests show, some of the functions have a strange and inconsistent behavior for corner cases. - Rename test_full_buffer() -> test_search_full_buffer() because textiter.c is used for other GtkTextIter unit tests.
Created attachment 273923 [details] [review] doc: improve documentation of gtk_text_iter_inside_word() There is a possible confusion with the sentence: "@iter is inside a natural-language word" The iter should be viewed here as the pointed character (i.e. on the right of the iter), not as a position between two characters. Instead of improving the documentation, another solution would have been to change the implementation so it is interpreted as an iter position inside a word, i.e. between two characters that are part of a natural-language word. But maybe some applications rely on the current implementation.
Created attachment 273924 [details] [review] textview: inline a function gtk_text_view_move_cursor_internal() was exactly the same as gtk_text_view_move_cursor(), and was called only in the latter function.
Created attachment 274130 [details] [review] GtkTextView: use GSlice to allocate GtkTextLineSegment's Use GSlice to allocate all types of segments: - char - toggle - mark - pixbuf - child widget Char segments are a bit more complicated because the length of the text is determined at run time and stored in the 'byte_count' field. If the text is long, GSlice will call the system malloc() anyway, so it's better to always use GSlice for GtkTextLineSegment. Toggle segments are also freed in gtktextbtree.c, hence the function _gtk_toggle_segment_free() (for a later commit it would be nice to rename those functions with the _gtk_text prefix).
Attachment 273922 [details] pushed as 704a178 - tests textiter: test word boundaries Attachment 273923 [details] pushed as 22ce03f - doc: improve documentation of gtk_text_iter_inside_word() Attachment 273924 [details] pushed as d69d57a - textview: inline a function Attachment 274130 [details] pushed as 983a03d - GtkTextView: use GSlice to allocate GtkTextLineSegment's