summaryrefslogtreecommitdiff
path: root/gtk/gtktextiter.c
Commit message (Collapse)AuthorAgeFilesLines
* textiter: fix bug in gtk_text_iter_backward_line()Nelson Benítez León2017-02-171-0/+2
| | | | | | | | | | | | | | | | gtk_text_iter_backward_line() checks the value of real->line_char_offset without previously calling ensure_char_offsets (real) to make sure the former is up-to-date. As a consequence of this, when gtk_text_iter_backward_line() is called after a gtk_text_buffer_insert_range() in the first line of buffer, the iter is not moved to the start of the line, and the return value is wrong. Fixed by adding the ensure_char_offsets() call. A test case for this bug is added to the textiter gtk testsuite.
* Make GtkTextAttributes privateMatthias Clasen2016-11-011-43/+26
| | | | | | | | This is a problematic struct, and giving direct access to it has kept us from making improvements to GtkTextView. Drop it from the public API, together with the auxiliary APIs. If it turns out that this functionality is needed, we should add individual getters.
* textiter: Remove deprecated gtk_text_iter_begins_tagRico Tzschichholz2016-10-241-25/+0
|
* Avoid an out-of-bounds accessMatthias Clasen2016-02-261-3/+6
| | | | | When the offset gets smaller than min_offset, we can't access the array at that position.
* Don't use gtk_text_iter_begins_tag() (deprecated)Sébastien Wilmet2015-12-081-3/+3
| | | | | | Use gtk_text_iter_starts_tag() instead. https://bugzilla.gnome.org/show_bug.cgi?id=759092
* textiter: add starts_tag() and deprecate begins_tag()Sébastien Wilmet2015-12-081-6/+32
| | | | | | | | | | | | The name gtk_text_*_begins_* was used only for begins_tag(). All other similar functions use "starts": starts_line(), starts_word(), etc. So for consistency, add gtk_text_iter_starts_tag() and deprecate gtk_text_iter_begins_tag(). Also change (allow-none) to (nullable), to use the new annotation. https://bugzilla.gnome.org/show_bug.cgi?id=759092
* textiter: fix bug in case insensitive backward searchSébastien Wilmet2015-11-301-13/+10
| | | | | | | | | | | | | | | | | | 'win.lines' contains the same content as the GtkTextBuffer, so to find @match_start, forward_chars_with_skipping() is called with skip_decomp=FALSE (the last parameter). So far so good. On the other hand, the content 'lines' (the needle split in lines) is casefolded and normalized for a case insensitive search. So, forward_chars_with_skipping(..., skip_decomp=TRUE) must be called only for the portion of text containing the needle. Since 'start_tmp' contains the location at the start of the match, we can simply begin at that location to find the end of the match. Unit tests are added. https://bugzilla.gnome.org/show_bug.cgi?id=758698
* Split off a private header for GtkTextBufferMatthias Clasen2015-10-151-0/+1
| | | | This avoids polluting the installed header with private symbols.
* textiter: fix bug in _gtk_text_btree_get_iter_at_last_toggle()Sébastien Wilmet2015-10-071-2/+9
| | | | | | | | | | | | | | | | If the last tag toggle is the end iter, the function returned the wrong tag toggle. This resulted in some bugs where the view wasn't relayout/redrawn correctly. The function also always returned TRUE, probably because the return value is used nowhere. But for consistency with _gtk_text_btree_get_iter_at_first_toggle(), it's better to keep the return value, and also because otherwise the function would be wrong (it doesn't always return a tag toggle, if there is none). https://bugzilla.gnome.org/show_bug.cgi?id=755413
* Clean up debug featuresMatthias Clasen2015-09-091-1/+1
| | | | | Introduce a GTK_DEBUG_CHECK() macro and use it to check for GTK_DEBUG flags everywhere. Also guard all such places by
* Minor documentation fixesMatthias Clasen2014-12-051-25/+25
|
* Simplify _gtk_text_buffer_get_line_log_attrs()Sébastien Wilmet2014-08-211-19/+7
| | | | | | | | | | | | | | | | NULL was returned in case of an empty last line. Every users needed to special-case this. Now it will return the expected result: char_len of 0 with one PangoLogAttr. In compute_log_attrs(), 'paragraph' will be the empty string "" with 'char_len' == 0. pango_get_log_attrs() works fine with an empty string, it will return one correct PangoLogAttr (because there is one text position for the empty string). It fixes the unit tests for gtk_text_iter_is_cursor_position(). https://bugzilla.gnome.org/show_bug.cgi?id=156164
* GtkTextView: various code clean-upsSébastien Wilmet2014-08-201-27/+25
| | | | | | | | - only one blank line is enough to separate code sections. - the 'signals' variable was in the middle of function prototypes. - compare pointers to NULL in some conditions ("if(blah) should be used only if blah is a boolean variable). It makes the code clearer. - various other things.
* Replace uses of g_memmove() by memmove()Sébastien Wilmet2014-08-161-1/+1
| | | | | | | g_memmove() is deprecated, it is a simple macro that just calls memmove() with the same parameters. Reviewed by Paolo Borelli on IRC.
* textiter: don't call g_utf8_prev_char() on start of stringSébastien Wilmet2014-07-311-2/+5
| | | | | | | | Changes also the "goto finally" with a break. A break is more common. Another way is to use g_utf8_find_prev_char(). https://bugzilla.gnome.org/show_bug.cgi?id=638709
* textiter: fix bug in find_visible_by_log_attrs()Sébastien Wilmet2014-07-171-2/+9
| | | | | | | | | | | | | | | find_by_log_attrs() can return true only in this case: return moved && !gtk_text_iter_is_end (arg_iter); So if the iter moved (i.e. something has been found), but is the end iter, find_by_log_attrs() returns false. Now the same checks are made in find_visible_by_log_attrs(). The public functions using find_visible_by_log_attrs() say in their documentation that false is returned for the end iter, hence the check with gtk_text_iter_is_end(). https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: fix bug in FindLogAttrFunc functionsSébastien Wilmet2014-07-171-3/+3
| | | | | | | | | | | | | | | | attrs[len] is the last PangoLogAttr available, at the iter position after the last character of the line. For a line in the middle or the start of the buffer, the '\n' is taken into account by 'len'. For example the is_word_end is generally reached before the '\n', not after. But for the last line in the buffer, where there is no trailing '\n', it is important to test until attrs[len]. The bug didn't occur before because find_by_log_attrs() worked directly on the iter passed as the function argument. But now it is no longer the case. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: make the FindLogAttrFunc functions clearerSébastien Wilmet2014-07-171-24/+60
| | | | | | | | | | | | - Return true (found) and false (not found) explicitly. - Set found_offset only when something has been found. find_backward_cursor_pos_func() was a bit different, the while loop had the condition "offset > 0" but the return was "offset >= 0". Probably a micro-optimization, since offset == 0 is always a cursor position. Anyway now the code is the same as the other functions. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: simplify FindLogAttrFuncSébastien Wilmet2014-07-171-56/+43
| | | | | | | The min_offset parameter was always 0. Since there are some bugs in this code, it'll be clearer if there are fewer parameters. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: fix bug in find_by_log_attrs()Sébastien Wilmet2014-07-171-16/+17
| | | | | | | | | | Do not work with the iter passed as the function argument. Work with another iter, and set it back to the function argument only if something has been found. This fixes a few unit tests. But there are regressions for a few others. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: small optimization for find_by_log_attrs()Sébastien Wilmet2014-07-131-6/+10
| | | | | | | | | | | | | | Use gtk_text_iter_set_line_offset (&tmp_iter, 0) instead of gtk_text_iter_get_line(). The difference should not be big. In the first case the line doesn't need to be traversed thanks to the offset 0. For get_line(), the btree must be traversed. A temporary iter is needed to not break the behavior. But the behavior is quite strange, the function works directly on the iter passed as an argument to the function, even if the function returns FALSE (not found). So maybe a later commit will fix this strange behavior. https://bugzilla.gnome.org/show_bug.cgi?id=629129
* textiter: remove recursivity of find_by_log_attrs()Sébastien Wilmet2014-07-131-49/+48
| | | | | | | | | | | | | | | find_by_log_attrs() was a recursive function. It is replaced by an iteration. The already_moved_initially parameter was TRUE only for the recursive call, so the paramater is removed. There is also a small cleanup of the find_visible_by_log_attrs() (remove trailing spaces, fix indentation). There is still a part to optimize for a later commit. https://bugzilla.gnome.org/show_bug.cgi?id=629129
* gtk: add missing ownership annotations ported from ValaEvan Nemerson2014-05-271-5/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=730745
* doc: improve documentation of gtk_text_iter_inside_word()Sébastien Wilmet2014-04-131-6/+9
| | | | | | | | | | | | | | | | 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. https://bugzilla.gnome.org/show_bug.cgi?id=727908
* docs: use Returns: consistentlyWilliam Jon McCann2014-02-191-80/+80
| | | | Instead of Return value:
* docs: use apostrophe in *'dWilliam Jon McCann2014-02-071-1/+1
|
* docs: use apostrophe in *'reWilliam Jon McCann2014-02-071-2/+2
|
* docs: use apostrophes in *n'tWilliam Jon McCann2014-02-071-14/+14
|
* docs: use proper apostropheWilliam Jon McCann2014-02-071-8/+8
| | | | https://wiki.gnome.org/Design/OS/Typography
* docs: Use markup for linksWilliam Jon McCann2014-02-071-2/+3
|
* docs: use proper quotesWilliam Jon McCann2014-02-051-10/+10
|
* docs: use ` instead of <literal>William Jon McCann2014-02-041-2/+2
|
* docs: don't use <emphasis>William Jon McCann2014-01-281-8/+8
| | | | It is a little heavy handed. The text can speak for itself.
* docs: use #*-struct instead of <structname>William Jon McCann2014-01-271-1/+1
|
* textiter: better document "tag" functionsSébastien Wilmet2013-06-301-12/+17
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=703313
* textiter: doc precision for forward_search() and backward_search()Sébastien Wilmet2013-06-291-1/+7
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=703313
* Document GtkTextSearchFlagsSébastien Wilmet2013-06-251-11/+1
| | | | | | | Move the doc about the flags from gtk_text_iter_forward_search() to the enum. https://bugzilla.gnome.org/show_bug.cgi?id=390048
* textiter: bug fix in forward_search() and backward_search()Sébastien Wilmet2013-06-241-5/+4
| | | | | | | | | | | | | | | | When the search is case sensitive, g_utf8_normalize() is not called, so the skip_decomp argument of the function forward_chars_with_skipping() must be FALSE. To verify that, when searching "éb", the count parameter of forward_chars_with_skipping() have a different value: - case sensitive: count = 2 - case insensitive: count = 3 (g_utf8_normalize() has been called) The commit adds unit tests that didn't pass before, and that now pass (without known regression, obviously). https://bugzilla.gnome.org/show_bug.cgi?id=702977
* Fix gtk_text_iter_forward_to_tag_toggle() for end iterSébastien Wilmet2013-06-201-0/+3
| | | | | | | | | | The function must return TRUE only if there is a tag toggle _after_ the iter, not _at_ the iter. So for the end iter, the function must always return FALSE. Add also unit tests for gtk_text_iter_forward_to_tag_toggle(). https://bugzilla.gnome.org/show_bug.cgi?id=691266
* Improve doc of gtk_text_iter_forward_search()Sébastien Wilmet2013-06-201-1/+1
| | | | | | | | It was not possible to know if the @limit was for @match_start or @match_end. It was documented for backward_search(), but not for forward_search(). https://bugzilla.gnome.org/show_bug.cgi?id=390048
* Small API doc fixesSébastien Wilmet2013-03-161-4/+4
| | | | | | For gtk_text_iter_get_char(), due to the "Returns" at the beginning of the description, the description was not visible. So the first sentence has been reworded.
* Fix malformed doc commentsMatthias Clasen2012-04-121-1/+1
| | | | | Most of these are forgotten :'s and similar details which gtk-doc now warns about.
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* Added gtk_text_iter_assign APIJesse van den Kieboom2011-08-151-0/+22
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=645258
* Don't use deprecated G_UNICODE_COMBINING_MARKAndre Klapper2011-07-221-1/+1
|
* [GI] Add missing (out) and (array) annotationsPavel Holejsovsky2011-01-201-1/+1
|
* Add case insensitive to GtkTextIter. Fixes bug #61852.Ignacio Casal Quinteiro2010-11-021-55/+342
| | | | | This code has been taken from GtkSourceView so also kudos to Paolo Maggi and Paolo Borelli for helping with this patch.
* Fix backward search bug exposed by the unit testPaolo Borelli2010-11-021-0/+2
| | | | | When searching with multiple lines first_line_start/end were initialized to the last line start/end iters
* Tons of transfer annotationsMatthias Clasen2010-09-211-5/+5
|
* Replace gtk_debug_flags with getter and setter functionsTor Lillqvist2010-09-081-1/+1
| | | | | | Preferrably should be made just into a local variable for libgtk like _gdk_debug_flags for libgdk. But for now used by gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.