Commit Graph

144 Commits

Author SHA1 Message Date
Sébastien Wilmet
dc1317a521 textiter: fix bug in find_visible_by_log_attrs()
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
2014-07-17 12:56:57 +02:00
Sébastien Wilmet
69d20f53e2 textiter: fix bug in FindLogAttrFunc functions
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
2014-07-17 12:56:56 +02:00
Sébastien Wilmet
76f3866bd3 textiter: make the FindLogAttrFunc functions clearer
- 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
2014-07-17 12:56:56 +02:00
Sébastien Wilmet
37f5f78f81 textiter: simplify FindLogAttrFunc
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
2014-07-17 12:56:56 +02:00
Sébastien Wilmet
5d66634482 textiter: fix bug in find_by_log_attrs()
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
2014-07-17 12:56:56 +02:00
Sébastien Wilmet
472fd9a75f textiter: small optimization for find_by_log_attrs()
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
2014-07-13 17:08:52 +02:00
Sébastien Wilmet
7f6ae622d3 textiter: remove recursivity of find_by_log_attrs()
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
2014-07-13 17:08:52 +02:00
Evan Nemerson
a77765f172 gtk: add missing ownership annotations ported from Vala
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:33 -07:00
Sébastien Wilmet
22ce03fd94 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.

https://bugzilla.gnome.org/show_bug.cgi?id=727908
2014-04-13 14:04:10 -07:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
cb6483d382 docs: use apostrophe in *'d 2014-02-07 13:39:53 -05:00
William Jon McCann
a4b5929e81 docs: use apostrophe in *'re 2014-02-07 13:37:09 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
a22358c0c0 docs: use ` instead of <literal> 2014-02-04 18:24:29 -05:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
William Jon McCann
22586ea7c2 docs: use #*-struct instead of <structname> 2014-01-27 19:59:55 -05:00
Sébastien Wilmet
158451b1ab textiter: better document "tag" functions
https://bugzilla.gnome.org/show_bug.cgi?id=703313
2013-06-30 10:38:25 +02:00
Sébastien Wilmet
f0a481d97b textiter: doc precision for forward_search() and backward_search()
https://bugzilla.gnome.org/show_bug.cgi?id=703313
2013-06-29 17:01:58 +02:00
Sébastien Wilmet
67d1183ac9 Document GtkTextSearchFlags
Move the doc about the flags from gtk_text_iter_forward_search() to the
enum.

https://bugzilla.gnome.org/show_bug.cgi?id=390048
2013-06-25 13:21:08 +02:00
Sébastien Wilmet
ea4e88df86 textiter: bug fix in forward_search() and backward_search()
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
2013-06-24 20:14:39 +02:00
Sébastien Wilmet
08d49fdd58 Fix gtk_text_iter_forward_to_tag_toggle() for end iter
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
2013-06-20 20:22:56 +02:00
Sébastien Wilmet
38d78f48b5 Improve doc of gtk_text_iter_forward_search()
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
2013-06-20 12:39:24 +02:00
Sébastien Wilmet
66dfab0b0a Small API doc fixes
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.
2013-03-16 22:18:50 +01:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Jesse van den Kieboom
99686a2fef Added gtk_text_iter_assign API
https://bugzilla.gnome.org/show_bug.cgi?id=645258
2011-08-15 15:29:23 +02:00
Andre Klapper
91706f7883 Don't use deprecated G_UNICODE_COMBINING_MARK 2011-07-22 19:56:49 +02:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Ignacio Casal Quinteiro
794e0446e9 Add case insensitive to GtkTextIter. Fixes bug #61852.
This code has been taken from GtkSourceView so also kudos to Paolo Maggi
and Paolo Borelli for helping with this patch.
2010-11-02 12:04:37 +09:00
Paolo Borelli
3511215730 Fix backward search bug exposed by the unit test
When searching with multiple lines first_line_start/end were initialized
to the last line start/end iters
2010-11-02 12:04:37 +09:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Tor Lillqvist
801875b805 Replace gtk_debug_flags with getter and setter functions
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.
2010-09-08 21:31:34 +03:00
Christian Persch
ffa07ee21e Use G_DEFINE_BOXED_TYPE
Bug #627214.
2010-08-18 15:34:47 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Ignacio Casal Quinteiro
7e3e2bf29a Fix annotation of gtk_text_iter_(forward/backward)_search. 2010-06-24 11:11:02 +02:00
Javier Jardón
c4bb15a4f2 Move documentation to inline comments: GtkTextIter 2010-05-13 01:26:09 +02:00
Johan Dahlin
fe85272112 [annotations] Add allow-none
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API

https://bugzilla.gnome.org/show_bug.cgi?id=610474
2010-02-19 17:57:51 -02:00
Colin Walters
6529c07614 [introspection] Merge in Gtk-custom.c annotations
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GTK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
2009-12-16 17:22:01 -02:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Matthias Clasen
1ece9d4e40 Fix an aliasing problem. (#347585, Ed Catmur)
2007-11-22  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktextiter.c: Fix an aliasing problem.  (#347585, Ed Catmur)


svn path=/trunk/; revision=19024
2007-11-22 05:50:32 +00:00
Yevgen Muntyan
921da326f5 sort returned tags array by tags priority (#497102).
2007-11-15  Yevgen Muntyan  <muntyan@tamu.edu>

	* gtk/gtktextbtree.c (_gtk_text_btree_get_tags): sort returned
	tags array by tags priority (#497102).
	* gtk/gtktextiter.c (gtk_text_iter_get_tags), (gtk_text_iter_get_attributes):
	* gtk/gtktextlayout.c (get_tags_array_at_iter): and do not sort it here.


svn path=/trunk/; revision=18995
2007-11-15 17:00:33 +00:00
Matthias Clasen
6abe62c95b Improve the docs. (#486155, Owen Taylor)
2007-10-16  Matthias Clasen <mclasen@redhat.com>

        * gtk/gtktextiter.c (gtk_text_iter_forward_line): Improve
        the docs.  (#486155, Owen Taylor)



svn path=/trunk/; revision=18914
2007-10-16 17:33:16 +00:00
Matthias Clasen
2824f4597d Internalize some strings, pointed out by Damon Chaplin.
2007-04-27  Matthias Clasen  <mclasen@redhat.com>

        * gtkassistant.c:
        * gtkiconfactory.c:
        * gtkiconview.c:
        * gtkpapersize.c:
        * gtkrecentmanager.c:
        * gtktextiter.c: Internalize some strings, pointed out
        by Damon Chaplin.



svn path=/trunk/; revision=17661
2007-04-27 23:10:38 +00:00
Matthias Clasen
82ce59cd0f Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder,
2007-03-09  Matthias Clasen <mclasen@redhat.com>

        * Everywhere: Remove unnecessary NULL checks before
        g_free().  (#369666, Morten Welinder, Djihed Afifi)

        * configure.in: Check for ftw.h



svn path=/trunk/; revision=17444
2007-03-09 21:57:37 +00:00
Matthias Clasen
07e7719441 Apply a cleanup patch by Kjartan Maraas (#341812)
2006-10-08  Matthias Clasen  <mclasen@redhat.com>

	* Apply a cleanup patch by Kjartan Maraas  (#341812)
2006-10-08 05:07:55 +00:00