Commit 72e6566b authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

Clarify behavior in docs, #61777 (gtk_text_iter_forward_search)

2001-10-22  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
	docs, #61777
	(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
	change the two boolean args to a flags field, so we can extend
	to add case insensitive, regexp searches later. #61852
parent 6bf176c3
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
2001-10-22 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (gtk_text_iter_set_line): Clarify behavior in
docs, #61777
(gtk_text_iter_forward_search) (gtk_text_iter_backward_search):
change the two boolean args to a flags field, so we can extend
to add case insensitive, regexp searches later. #61852
Mon Oct 22 15:07:17 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_iter_depth): update docs to
......
......@@ -96,9 +96,9 @@ Creates a new #GtkMenu.
Adds a new #GtkMenuItem to the end of the menu's item list.
</para>
<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
<!-- # Unused Parameters # -->
@m:
@c:
......@@ -108,9 +108,9 @@ Adds a new #GtkMenuItem to the end of the menu's item list.
Adds a new #GtkMenuItem to the beginning of the menu's item list.
</para>
<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
<!-- # Unused Parameters # -->
@menu_child:
@m:
@c:
......@@ -122,10 +122,10 @@ Adds a new #GtkMenuItem to the menu's item list at the position
indicated by @position.
</para>
<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
@pos:
<!-- # Unused Parameters # -->
@position: The position in the item list where @child is added.
Positions are numbered from 0 to n-1.
......
......@@ -715,12 +715,14 @@ types related to the text widget and how they work together.
@iter:
@str:
@visible_only:
@slice:
@flags:
@match_start:
@match_end:
@limit:
@Returns:
<!-- # Unused Parameters # -->
@visible_only:
@slice:
<!-- ##### FUNCTION gtk_text_iter_backward_search ##### -->
......@@ -730,12 +732,14 @@ types related to the text widget and how they work together.
@iter:
@str:
@visible_only:
@slice:
@flags:
@match_start:
@match_end:
@limit:
@Returns:
<!-- # Unused Parameters # -->
@visible_only:
@slice:
<!-- ##### FUNCTION gtk_text_iter_equal ##### -->
......
......@@ -3632,7 +3632,9 @@ gtk_text_iter_set_visible_line_index (GtkTextIter *iter,
* @iter: a #GtkTextIter
* @line_number: line number (counted from 0)
*
* Moves iterator @iter to the start of the line @line_number.
* Moves iterator @iter to the start of the line @line_number. If
* @line_number is negative or larger than the number of lines in the
* buffer, moves @iter to the start of the last line in the buffer.
*
**/
void
......@@ -4243,23 +4245,31 @@ strbreakup (const char *string,
* gtk_text_iter_forward_search:
* @iter: start of search
* @str: a search string
* @visible_only: if %TRUE, search only visible text
* @slice: if %TRUE, @str contains 0xFFFC when we want to match widgets, pixbufs
* @flags: flags affecting how the search is done
* @match_start: return location for start of match, or %NULL
* @match_end: return location for end of match, or %NULL
* @limit: bound for the search, or %NULL for the end of the buffer
*
* Searches forward for @str. Any match is returned as the range @match_start,
* @match_end. If you specify @visible_only or @slice, the match may have
* invisible text, pixbufs, or child widgets interspersed in @str.
* Searches forward for @str. Any match is returned as the range
* @match_start, @match_end. The search will not continue past
* @limit. Note that a search is a linear or O(n) operation, so you
* may wish to use @limit to avoid locking up your UI on large
* buffers.
*
* If the #GTK_TEXT_SEARCH_VISIBLE_ONLY flag is present, the match may
* have invisible text interspersed in @str. i.e. @str will be a
* possibly-noncontiguous subsequence of the matched range. similarly,
* if you specify #GTK_TEXT_SEARCH_TEXT_ONLY, the match may have
* pixbufs or child widgets mixed inside the matched range. If these
* flags are not given, the match must be exact; the special 0xFFFC
* character in @str will match embedded pixbufs or child widgets.
*
* Return value: whether a match was found
**/
gboolean
gtk_text_iter_forward_search (const GtkTextIter *iter,
const gchar *str,
gboolean visible_only,
gboolean slice,
GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit)
......@@ -4268,7 +4278,9 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
GtkTextIter match;
gboolean retval = FALSE;
GtkTextIter search;
gboolean visible_only;
gboolean slice;
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (str != NULL, FALSE);
......@@ -4297,6 +4309,9 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
return FALSE;
}
visible_only = (flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0;
slice = (flags & GTK_TEXT_SEARCH_TEXT_ONLY) == 0;
/* locate all lines */
lines = strbreakup (str, "\n", -1);
......@@ -4563,8 +4578,7 @@ my_strrstr (const gchar *haystack,
* gtk_text_iter_backward_search:
* @iter: a #GtkTextIter where the search begins
* @str: search string
* @visible_only: if %TRUE search only visible text
* @slice: if %TRUE the search string contains 0xFFFC to match pixbufs, widgets
* @flags: bitmask of flags affecting the search
* @match_start: return location for start of match, or %NULL
* @match_end: return location for end of match, or %NULL
* @limit: location of last possible @match_start, or %NULL for start of buffer
......@@ -4576,8 +4590,7 @@ my_strrstr (const gchar *haystack,
gboolean
gtk_text_iter_backward_search (const GtkTextIter *iter,
const gchar *str,
gboolean visible_only,
gboolean slice,
GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit)
......@@ -4587,7 +4600,9 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
gint n_lines;
LinesWindow win;
gboolean retval = FALSE;
gboolean visible_only;
gboolean slice;
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (str != NULL, FALSE);
......@@ -4615,6 +4630,9 @@ gtk_text_iter_backward_search (const GtkTextIter *iter,
return FALSE;
}
visible_only = (flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0;
slice = (flags & GTK_TEXT_SEARCH_TEXT_ONLY) == 0;
/* locate all lines */
lines = strbreakup (str, "\n", -1);
......
......@@ -34,6 +34,12 @@
extern "C" {
#endif /* __cplusplus */
typedef enum {
GTK_TEXT_SEARCH_VISIBLE_ONLY,
GTK_TEXT_SEARCH_TEXT_ONLY
/* Possible future plans: SEARCH_CASE_INSENSITIVE, SEARCH_REGEXP */
} GtkTextSearchFlags;
/*
* Iter: represents a location in the text. Becomes invalid if the
* characters/pixmaps/widgets (indexable objects) in the text buffer
......@@ -236,16 +242,14 @@ gboolean gtk_text_iter_backward_find_char (GtkTextIter *iter,
gboolean gtk_text_iter_forward_search (const GtkTextIter *iter,
const gchar *str,
gboolean visible_only,
gboolean slice,
GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit);
gboolean gtk_text_iter_backward_search (const GtkTextIter *iter,
const gchar *str,
gboolean visible_only,
gboolean slice,
GtkTextSearchFlags flags,
GtkTextIter *match_start,
GtkTextIter *match_end,
const GtkTextIter *limit);
......
......@@ -1578,7 +1578,9 @@ buffer_search (Buffer *buffer,
if (forward)
{
while (gtk_text_iter_forward_search (&iter, str, TRUE, FALSE,
while (gtk_text_iter_forward_search (&iter, str,
GTK_TEXT_SEARCH_VISIBLE_ONLY |
GTK_TEXT_SEARCH_TEXT_ONLY,
&match_start, &match_end,
NULL))
{
......@@ -1591,7 +1593,9 @@ buffer_search (Buffer *buffer,
}
else
{
while (gtk_text_iter_backward_search (&iter, str, TRUE, FALSE,
while (gtk_text_iter_backward_search (&iter, str,
GTK_TEXT_SEARCH_VISIBLE_ONLY |
GTK_TEXT_SEARCH_TEXT_ONLY,
&match_start, &match_end,
NULL))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment