2005-07-13 05:44:22 +00:00
|
|
|
/* testtextbuffer.c -- Simplistic test suite
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc
|
|
|
|
* Author: Havoc Pennington
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2005-07-13 05:44:22 +00:00
|
|
|
*/
|
2001-04-03 18:48:46 +00:00
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2000-06-02 17:27:21 +00:00
|
|
|
#include <stdio.h>
|
2001-09-24 23:12:39 +00:00
|
|
|
#include <string.h>
|
2000-06-02 17:27:21 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2022-10-06 02:59:51 +00:00
|
|
|
#include "gtk/gtktexttypesprivate.h" /* Private header, for UNKNOWN_CHAR */
|
2022-08-04 22:34:41 +00:00
|
|
|
#include "gtk/gtktextbufferprivate.h" /* Private header */
|
2000-06-02 17:27:21 +00:00
|
|
|
|
2001-09-08 19:33:06 +00:00
|
|
|
static void
|
2020-07-24 18:40:36 +00:00
|
|
|
gtk_text_iter_spew (const GtkTextIter *iter, const char *desc)
|
2001-09-08 19:33:06 +00:00
|
|
|
{
|
|
|
|
g_print (" %20s: line %d / char %d / line char %d / line byte %d\n",
|
|
|
|
desc,
|
|
|
|
gtk_text_iter_get_line (iter),
|
|
|
|
gtk_text_iter_get_offset (iter),
|
|
|
|
gtk_text_iter_get_line_offset (iter),
|
|
|
|
gtk_text_iter_get_line_index (iter));
|
|
|
|
}
|
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
static void
|
|
|
|
check_get_set_text (GtkTextBuffer *buffer,
|
|
|
|
const char *str)
|
|
|
|
{
|
2001-10-22 23:35:03 +00:00
|
|
|
GtkTextIter start, end, iter;
|
2001-09-25 18:31:40 +00:00
|
|
|
char *text;
|
|
|
|
int n;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
gtk_text_buffer_set_text (buffer, str, -1);
|
|
|
|
if (gtk_text_buffer_get_char_count (buffer) != g_utf8_strlen (str, -1))
|
|
|
|
g_error ("Wrong number of chars (%d not %d)",
|
|
|
|
gtk_text_buffer_get_char_count (buffer),
|
|
|
|
(int) g_utf8_strlen (str, -1));
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
|
|
|
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
|
|
|
|
if (strcmp (text, str) != 0)
|
|
|
|
g_error ("Got '%s' as buffer contents", text);
|
|
|
|
g_free (text);
|
|
|
|
|
2001-10-22 23:35:03 +00:00
|
|
|
/* line char counts */
|
|
|
|
iter = start;
|
|
|
|
n = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n += gtk_text_iter_get_chars_in_line (&iter);
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_forward_line (&iter));
|
|
|
|
|
|
|
|
if (n != gtk_text_buffer_get_char_count (buffer))
|
|
|
|
g_error ("Sum of chars in lines is %d but buffer char count is %d",
|
|
|
|
n, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
|
|
|
/* line byte counts */
|
|
|
|
iter = start;
|
|
|
|
n = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
n += gtk_text_iter_get_bytes_in_line (&iter);
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_forward_line (&iter));
|
|
|
|
|
|
|
|
if (n != strlen (str))
|
|
|
|
g_error ("Sum of chars in lines is %d but buffer byte count is %d",
|
2003-01-09 02:38:13 +00:00
|
|
|
n, (int) strlen (str));
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
gtk_text_buffer_set_text (buffer, "", -1);
|
|
|
|
|
|
|
|
n = gtk_text_buffer_get_line_count (buffer);
|
|
|
|
if (n != 1)
|
|
|
|
g_error ("%d lines, expected 1", n);
|
|
|
|
|
|
|
|
n = gtk_text_buffer_get_char_count (buffer);
|
|
|
|
if (n != 0)
|
|
|
|
g_error ("%d chars, expected 0", n);
|
|
|
|
}
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
static int
|
2000-10-04 14:23:09 +00:00
|
|
|
count_toggles_at_iter (GtkTextIter *iter,
|
|
|
|
GtkTextTag *of_tag)
|
|
|
|
{
|
|
|
|
GSList *tags;
|
|
|
|
GSList *tmp;
|
2020-07-24 13:54:49 +00:00
|
|
|
int count = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* get toggle-ons and toggle-offs */
|
|
|
|
tags = gtk_text_iter_get_toggled_tags (iter, TRUE);
|
|
|
|
tags = g_slist_concat (tags,
|
|
|
|
gtk_text_iter_get_toggled_tags (iter, FALSE));
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tmp = tags;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
if (of_tag == NULL)
|
|
|
|
++count;
|
|
|
|
else if (of_tag == tmp->data)
|
|
|
|
++count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-10-20 00:42:52 +00:00
|
|
|
tmp = tmp->next;
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
g_slist_free (tags);
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
2001-10-24 04:48:21 +00:00
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
static int
|
2001-10-24 04:48:21 +00:00
|
|
|
count_toggles_in_range_by_char (GtkTextBuffer *buffer,
|
|
|
|
GtkTextTag *of_tag,
|
|
|
|
const GtkTextIter *start,
|
|
|
|
const GtkTextIter *end)
|
2000-10-04 14:23:09 +00:00
|
|
|
{
|
|
|
|
GtkTextIter iter;
|
2020-07-24 13:54:49 +00:00
|
|
|
int count = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-24 04:48:21 +00:00
|
|
|
iter = *start;
|
2000-10-04 14:23:09 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
count += count_toggles_at_iter (&iter, of_tag);
|
2001-10-24 04:48:21 +00:00
|
|
|
if (!gtk_text_iter_forward_char (&iter))
|
|
|
|
{
|
|
|
|
/* end iterator */
|
|
|
|
count += count_toggles_at_iter (&iter, of_tag);
|
|
|
|
break;
|
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
2001-10-24 04:48:21 +00:00
|
|
|
while (gtk_text_iter_compare (&iter, end) <= 0);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
static int
|
2001-10-24 04:48:21 +00:00
|
|
|
count_toggles_in_buffer (GtkTextBuffer *buffer,
|
|
|
|
GtkTextTag *of_tag)
|
|
|
|
{
|
|
|
|
GtkTextIter start, end;
|
|
|
|
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
|
|
|
|
|
|
|
return count_toggles_in_range_by_char (buffer, of_tag, &start, &end);
|
|
|
|
}
|
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
static void
|
2001-10-24 04:48:21 +00:00
|
|
|
check_specific_tag_in_range (GtkTextBuffer *buffer,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *tag_name,
|
2001-10-24 04:48:21 +00:00
|
|
|
const GtkTextIter *start,
|
|
|
|
const GtkTextIter *end)
|
2000-10-04 14:23:09 +00:00
|
|
|
{
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextTag *tag;
|
|
|
|
gboolean state;
|
2020-07-24 13:54:49 +00:00
|
|
|
int count;
|
|
|
|
int buffer_count;
|
|
|
|
int last_offset;
|
2001-10-24 04:48:21 +00:00
|
|
|
|
|
|
|
if (gtk_text_iter_compare (start, end) > 0)
|
|
|
|
{
|
|
|
|
g_print (" (inverted range for checking tags, skipping)\n");
|
|
|
|
return;
|
|
|
|
}
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag = gtk_text_tag_table_lookup (gtk_text_buffer_get_tag_table (buffer),
|
|
|
|
tag_name);
|
|
|
|
|
2001-10-24 04:48:21 +00:00
|
|
|
buffer_count = count_toggles_in_range_by_char (buffer, tag, start, end);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
state = FALSE;
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
last_offset = -1;
|
2001-10-24 04:48:21 +00:00
|
|
|
iter = *start;
|
2000-10-04 14:23:09 +00:00
|
|
|
if (gtk_text_iter_toggles_tag (&iter, tag) ||
|
|
|
|
gtk_text_iter_forward_to_tag_toggle (&iter, tag))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
int this_offset;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
++count;
|
|
|
|
|
|
|
|
this_offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
|
|
|
|
if (this_offset <= last_offset)
|
|
|
|
g_error ("forward_to_tag_toggle moved in wrong direction");
|
|
|
|
|
|
|
|
last_offset = this_offset;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-12-06 16:49:01 +00:00
|
|
|
if (gtk_text_iter_starts_tag (&iter, tag))
|
2000-10-04 14:23:09 +00:00
|
|
|
{
|
|
|
|
if (state)
|
|
|
|
g_error ("Tag %p is already on, and was toggled on?", tag);
|
|
|
|
state = TRUE;
|
2022-08-04 22:34:41 +00:00
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
else if (gtk_text_iter_ends_tag (&iter, tag))
|
|
|
|
{
|
|
|
|
if (!state)
|
|
|
|
g_error ("Tag %p toggled off, but wasn't toggled on?", tag);
|
|
|
|
state = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_error ("forward_to_tag_toggle went to a location without a toggle");
|
|
|
|
}
|
2001-10-24 04:48:21 +00:00
|
|
|
while (gtk_text_iter_forward_to_tag_toggle (&iter, tag) &&
|
|
|
|
gtk_text_iter_compare (&iter, end) <= 0);
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count != buffer_count)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Counted %d tags iterating by char, %d iterating forward by tag toggle",
|
2000-10-04 14:23:09 +00:00
|
|
|
buffer_count, count);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
state = FALSE;
|
|
|
|
count = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-24 04:48:21 +00:00
|
|
|
iter = *end;
|
2000-10-04 14:23:09 +00:00
|
|
|
last_offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
if (gtk_text_iter_toggles_tag (&iter, tag) ||
|
|
|
|
gtk_text_iter_backward_to_tag_toggle (&iter, tag))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
int this_offset;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
++count;
|
|
|
|
|
|
|
|
this_offset = gtk_text_iter_get_offset (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
if (this_offset >= last_offset)
|
|
|
|
g_error ("backward_to_tag_toggle moved in wrong direction");
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
last_offset = this_offset;
|
|
|
|
|
2015-12-06 16:49:01 +00:00
|
|
|
if (gtk_text_iter_starts_tag (&iter, tag))
|
2000-10-04 14:23:09 +00:00
|
|
|
{
|
|
|
|
if (!state)
|
|
|
|
g_error ("Tag %p wasn't on when we got to the on toggle going backward?", tag);
|
|
|
|
state = FALSE;
|
|
|
|
}
|
|
|
|
else if (gtk_text_iter_ends_tag (&iter, tag))
|
|
|
|
{
|
|
|
|
if (state)
|
|
|
|
g_error ("Tag %p off toggle, but we were already inside a tag?", tag);
|
|
|
|
state = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_error ("backward_to_tag_toggle went to a location without a toggle");
|
|
|
|
}
|
2001-10-24 04:48:21 +00:00
|
|
|
while (gtk_text_iter_backward_to_tag_toggle (&iter, tag) &&
|
|
|
|
gtk_text_iter_compare (&iter, start) >= 0);
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count != buffer_count)
|
2001-10-24 04:48:21 +00:00
|
|
|
g_error ("Counted %d tags iterating by char, %d iterating backward by tag toggle\n",
|
2000-10-04 14:23:09 +00:00
|
|
|
buffer_count, count);
|
2001-10-24 04:48:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_specific_tag (GtkTextBuffer *buffer,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *tag_name)
|
2001-10-24 04:48:21 +00:00
|
|
|
{
|
|
|
|
GtkTextIter start, end;
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2001-10-24 04:48:21 +00:00
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
|
|
|
check_specific_tag_in_range (buffer, tag_name, &start, &end);
|
|
|
|
gtk_text_iter_forward_chars (&start, 2);
|
|
|
|
gtk_text_iter_backward_chars (&end, 2);
|
|
|
|
if (gtk_text_iter_compare (&start, &end) < 0)
|
|
|
|
check_specific_tag_in_range (buffer, tag_name, &start, &end);
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
static void
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
run_tests (GtkTextBuffer *buffer)
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextIter start;
|
|
|
|
GtkTextIter end;
|
|
|
|
GtkTextIter mark;
|
2020-07-24 13:54:49 +00:00
|
|
|
int i, j;
|
|
|
|
int num_chars;
|
2000-06-02 17:27:21 +00:00
|
|
|
GtkTextMark *bar_mark;
|
2000-10-04 14:23:09 +00:00
|
|
|
GtkTextTag *tag;
|
|
|
|
GHashTable *tag_states;
|
2020-07-24 13:54:49 +00:00
|
|
|
int count;
|
|
|
|
int buffer_count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-10-02 14:29:24 +00:00
|
|
|
/* Check that walking the tree via chars and via iterators produces
|
2000-06-02 17:27:21 +00:00
|
|
|
* the same number of indexable locations.
|
|
|
|
*/
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
num_chars = gtk_text_buffer_get_char_count (buffer);
|
2000-06-02 17:27:21 +00:00
|
|
|
iter = start;
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
bar_mark = gtk_text_buffer_create_mark (buffer, "bar", &iter, FALSE);
|
2000-06-02 17:27:21 +00:00
|
|
|
i = 0;
|
|
|
|
while (i < num_chars)
|
|
|
|
{
|
|
|
|
GtkTextIter current;
|
|
|
|
GtkTextMark *foo_mark;
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, ¤t, i);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, ¤t))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("get_char_index didn't return current iter");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
j = gtk_text_iter_get_offset (&iter);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
|
|
|
if (i != j)
|
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("iter converted to %d not %d", j, i);
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get/set mark */
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &mark, bar_mark);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &mark))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_spew (&iter, "iter");
|
|
|
|
gtk_text_iter_spew (&mark, "mark");
|
|
|
|
g_error ("Mark not moved to the right place.");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
foo_mark = gtk_text_buffer_create_mark (buffer, "foo", &iter, FALSE);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &mark, foo_mark);
|
|
|
|
gtk_text_buffer_delete_mark (buffer, foo_mark);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &mark))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_spew (&iter, "iter");
|
|
|
|
gtk_text_iter_spew (&mark, "mark");
|
|
|
|
g_error ("Mark not created in the right place.");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
|
2001-02-17 00:11:03 +00:00
|
|
|
if (gtk_text_iter_is_end (&iter))
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("iterators ran out before chars (offset %d of %d)",
|
|
|
|
i, num_chars);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-12-11 15:51:20 +00:00
|
|
|
gtk_text_iter_forward_char (&iter);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &end))
|
|
|
|
g_error ("Iterating over all chars didn't end with the end iter");
|
2000-06-02 17:27:21 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* Do the tree-walk backward
|
2000-06-02 17:27:21 +00:00
|
|
|
*/
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
num_chars = gtk_text_buffer_get_char_count (buffer);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, -1);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
i = num_chars;
|
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &end))
|
|
|
|
g_error ("iter at char -1 is not equal to the end iterator");
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
while (i >= 0)
|
|
|
|
{
|
|
|
|
GtkTextIter current;
|
|
|
|
GtkTextMark *foo_mark;
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, ¤t, i);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, ¤t))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("get_char_index didn't return current iter while going backward");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
j = gtk_text_iter_get_offset (&iter);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
|
|
|
if (i != j)
|
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("going backward, iter converted to %d not %d", j, i);
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get/set mark */
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &mark, bar_mark);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &mark))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_spew (&iter, "iter");
|
|
|
|
gtk_text_iter_spew (&mark, "mark");
|
|
|
|
g_error ("Mark not moved to the right place.");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
foo_mark = gtk_text_buffer_create_mark (buffer, "foo", &iter, FALSE);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &mark, foo_mark);
|
|
|
|
gtk_text_buffer_delete_mark (buffer, foo_mark);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &mark))
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_spew (&iter, "iter");
|
|
|
|
gtk_text_iter_spew (&mark, "mark");
|
|
|
|
g_error ("Mark not created in the right place.");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
if (i > 0)
|
|
|
|
{
|
2000-12-11 15:51:20 +00:00
|
|
|
if (!gtk_text_iter_backward_char (&iter))
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("iterators ran out before char indexes");
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-11 15:51:20 +00:00
|
|
|
if (gtk_text_iter_backward_char (&iter))
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_error ("went backward from 0?");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2000-06-02 17:27:21 +00:00
|
|
|
--i;
|
|
|
|
}
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (!gtk_text_iter_equal (&iter, &start))
|
|
|
|
g_error ("Iterating backward over all chars didn't end with the start iter");
|
2000-06-02 17:27:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check that get_line_count returns the same number of lines
|
|
|
|
* as walking the tree by line
|
|
|
|
*/
|
|
|
|
i = 1; /* include current (first) line */
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_line (buffer, &iter, 0);
|
|
|
|
while (gtk_text_iter_forward_line (&iter))
|
2000-06-02 17:27:21 +00:00
|
|
|
++i;
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
if (i != gtk_text_buffer_get_line_count (buffer))
|
|
|
|
g_error ("Counted %d lines, buffer has %d", i,
|
2000-10-02 14:29:24 +00:00
|
|
|
gtk_text_buffer_get_line_count (buffer));
|
2000-10-04 14:23:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check that moving over tag toggles thinks about working.
|
|
|
|
*/
|
|
|
|
|
|
|
|
buffer_count = count_toggles_in_buffer (buffer, NULL);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag_states = g_hash_table_new (NULL, NULL);
|
|
|
|
count = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
|
|
|
if (gtk_text_iter_toggles_tag (&iter, NULL) ||
|
|
|
|
gtk_text_iter_forward_to_tag_toggle (&iter, NULL))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
GSList *tags;
|
|
|
|
GSList *tmp;
|
|
|
|
gboolean found_some = FALSE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* get toggled-on tags */
|
|
|
|
tags = gtk_text_iter_get_toggled_tags (&iter, TRUE);
|
|
|
|
|
|
|
|
if (tags)
|
|
|
|
found_some = TRUE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tmp = tags;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
++count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag = tmp->data;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
if (g_hash_table_lookup (tag_states, tag))
|
|
|
|
g_error ("Tag %p is already on, and was toggled on?", tag);
|
|
|
|
|
|
|
|
g_hash_table_insert (tag_states, tag, GINT_TO_POINTER (TRUE));
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-10-20 00:42:52 +00:00
|
|
|
tmp = tmp->next;
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (tags);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* get toggled-off tags */
|
|
|
|
tags = gtk_text_iter_get_toggled_tags (&iter, FALSE);
|
|
|
|
|
|
|
|
if (tags)
|
|
|
|
found_some = TRUE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tmp = tags;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
++count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag = tmp->data;
|
|
|
|
|
|
|
|
if (!g_hash_table_lookup (tag_states, tag))
|
|
|
|
g_error ("Tag %p is already off, and was toggled off?", tag);
|
|
|
|
|
|
|
|
g_hash_table_remove (tag_states, tag);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-10-20 00:42:52 +00:00
|
|
|
tmp = tmp->next;
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (tags);
|
|
|
|
|
|
|
|
if (!found_some)
|
|
|
|
g_error ("No tags found going forward to tag toggle.");
|
|
|
|
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_forward_to_tag_toggle (&iter, NULL));
|
|
|
|
}
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
g_hash_table_destroy (tag_states);
|
|
|
|
|
|
|
|
if (count != buffer_count)
|
|
|
|
g_error ("Counted %d tags iterating by char, %d iterating by tag toggle\n",
|
|
|
|
buffer_count, count);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* Go backward; here TRUE in the hash means we saw
|
|
|
|
* an off toggle last.
|
|
|
|
*/
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag_states = g_hash_table_new (NULL, NULL);
|
|
|
|
count = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-02-17 00:11:03 +00:00
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
2000-10-04 14:23:09 +00:00
|
|
|
if (gtk_text_iter_toggles_tag (&iter, NULL) ||
|
|
|
|
gtk_text_iter_backward_to_tag_toggle (&iter, NULL))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
GSList *tags;
|
|
|
|
GSList *tmp;
|
|
|
|
gboolean found_some = FALSE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* get toggled-off tags */
|
|
|
|
tags = gtk_text_iter_get_toggled_tags (&iter, FALSE);
|
|
|
|
|
|
|
|
if (tags)
|
|
|
|
found_some = TRUE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tmp = tags;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
++count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag = tmp->data;
|
|
|
|
|
|
|
|
if (g_hash_table_lookup (tag_states, tag))
|
|
|
|
g_error ("Tag %p has two off-toggles in a row?", tag);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
g_hash_table_insert (tag_states, tag, GINT_TO_POINTER (TRUE));
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-10-20 00:42:52 +00:00
|
|
|
tmp = tmp->next;
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (tags);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* get toggled-on tags */
|
|
|
|
tags = gtk_text_iter_get_toggled_tags (&iter, TRUE);
|
|
|
|
|
|
|
|
if (tags)
|
|
|
|
found_some = TRUE;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tmp = tags;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
++count;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
tag = tmp->data;
|
|
|
|
|
|
|
|
if (!g_hash_table_lookup (tag_states, tag))
|
|
|
|
g_error ("Tag %p was toggled on, but saw no off-toggle?", tag);
|
|
|
|
|
|
|
|
g_hash_table_remove (tag_states, tag);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2015-10-20 00:42:52 +00:00
|
|
|
tmp = tmp->next;
|
2000-10-04 14:23:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (tags);
|
|
|
|
|
|
|
|
if (!found_some)
|
|
|
|
g_error ("No tags found going backward to tag toggle.");
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_backward_to_tag_toggle (&iter, NULL));
|
|
|
|
}
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
g_hash_table_destroy (tag_states);
|
|
|
|
|
|
|
|
if (count != buffer_count)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Counted %d tags iterating by char, %d iterating by tag toggle",
|
2000-10-04 14:23:09 +00:00
|
|
|
buffer_count, count);
|
|
|
|
|
|
|
|
check_specific_tag (buffer, "fg_red");
|
|
|
|
check_specific_tag (buffer, "bg_green");
|
|
|
|
check_specific_tag (buffer, "front_tag");
|
|
|
|
check_specific_tag (buffer, "center_tag");
|
|
|
|
check_specific_tag (buffer, "end_tag");
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-18 04:31:11 +00:00
|
|
|
static const char *book_closed_xpm[] = {
|
2000-06-02 17:27:21 +00:00
|
|
|
"16 16 6 1",
|
|
|
|
" c None s None",
|
|
|
|
". c black",
|
|
|
|
"X c red",
|
|
|
|
"o c yellow",
|
|
|
|
"O c #808080",
|
|
|
|
"# c white",
|
|
|
|
" ",
|
|
|
|
" .. ",
|
|
|
|
" ..XX. ",
|
|
|
|
" ..XXXXX. ",
|
|
|
|
" ..XXXXXXXX. ",
|
|
|
|
".ooXXXXXXXXX. ",
|
|
|
|
"..ooXXXXXXXXX. ",
|
|
|
|
".X.ooXXXXXXXXX. ",
|
|
|
|
".XX.ooXXXXXX.. ",
|
|
|
|
" .XX.ooXXX..#O ",
|
|
|
|
" .XX.oo..##OO. ",
|
|
|
|
" .XX..##OO.. ",
|
|
|
|
" .X.#OO.. ",
|
|
|
|
" ..O.. ",
|
|
|
|
" .. ",
|
|
|
|
" "};
|
|
|
|
|
|
|
|
static void
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
fill_buffer (GtkTextBuffer *buffer)
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
|
|
|
GtkTextTag *tag;
|
2014-08-20 15:13:46 +00:00
|
|
|
GdkRGBA color;
|
|
|
|
GdkRGBA color2;
|
2000-06-02 17:27:21 +00:00
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextIter iter2;
|
2000-09-30 00:17:22 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
2017-11-30 04:22:13 +00:00
|
|
|
GdkTexture *texture;
|
2000-06-02 17:27:21 +00:00
|
|
|
int i;
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2014-08-20 15:13:46 +00:00
|
|
|
color.red = 0.0;
|
|
|
|
color.green = 0.0;
|
|
|
|
color.blue = 1.0;
|
|
|
|
color.alpha = 1.0;
|
|
|
|
|
|
|
|
color2.red = 1.0;
|
|
|
|
color2.green = 0.0;
|
|
|
|
color2.blue = 0.0;
|
|
|
|
color2.alpha = 1.0;
|
|
|
|
|
2001-03-16 19:32:20 +00:00
|
|
|
gtk_text_buffer_create_tag (buffer, "fg_blue",
|
2014-08-20 15:13:46 +00:00
|
|
|
"foreground_rgba", &color,
|
|
|
|
"background_rgba", &color2,
|
2001-03-16 19:32:20 +00:00
|
|
|
"font", "-*-courier-bold-r-*-*-30-*-*-*-*-*-*-*",
|
|
|
|
NULL);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
2014-08-20 15:13:46 +00:00
|
|
|
color.red = 1.0;
|
|
|
|
color.green = 0.0;
|
|
|
|
color.blue = 0.0;
|
|
|
|
|
2001-03-16 19:32:20 +00:00
|
|
|
gtk_text_buffer_create_tag (buffer, "fg_red",
|
|
|
|
"rise", -4,
|
2014-08-20 15:13:46 +00:00
|
|
|
"foreground_rgba", &color,
|
2001-03-16 19:32:20 +00:00
|
|
|
NULL);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
2014-08-20 15:13:46 +00:00
|
|
|
color.red = 0.0;
|
|
|
|
color.green = 1.0;
|
|
|
|
color.blue = 0.0;
|
|
|
|
|
2001-03-16 19:32:20 +00:00
|
|
|
gtk_text_buffer_create_tag (buffer, "bg_green",
|
2014-08-20 15:13:46 +00:00
|
|
|
"background_rgba", &color,
|
2001-03-16 19:32:20 +00:00
|
|
|
"font", "-*-courier-bold-r-*-*-10-*-*-*-*-*-*-*",
|
|
|
|
NULL);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
2000-09-30 00:17:22 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
|
2017-11-30 04:22:13 +00:00
|
|
|
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_nonnull (texture);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2014-08-20 15:13:46 +00:00
|
|
|
for (i = 0; i < 10; i++)
|
2000-06-02 17:27:21 +00:00
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
char *str;
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (texture));
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (texture));
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
str = g_strdup_printf ("%d Hello World!\nwoo woo woo woo woo woo woo woo\n",
|
2000-06-02 17:27:21 +00:00
|
|
|
i);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_insert (buffer, &iter, str, -1);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
g_free (str);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_insert (buffer, &iter,
|
2000-06-02 17:27:21 +00:00
|
|
|
"(Hello World!)\nfoo foo Hello this is some text we are using to text word wrap. It has punctuation! gee; blah - hmm, great.\nnew line\n\n"
|
|
|
|
/* This is UTF8 stuff, Emacs doesn't
|
|
|
|
really know how to display it */
|
2002-12-07 00:03:34 +00:00
|
|
|
"Spanish (Espa\303\261ol) \302\241Hola! / French (Fran\303\247ais) Bonjour, Salut / German (Deutsch S\303\274d) Gr\303\274\303\237 Gott (testing Latin-1 chars encoded in UTF8)\nThai (we can't display this, just making sure we don't crash) (\340\270\240\340\270\262\340\270\251\340\270\262\340\271\204\340\270\227\340\270\242) \340\270\252\340\270\247\340\270\261\340\270\252\340\270\224\340\270\265\340\270\204\340\270\243\340\270\261\340\270\232, \340\270\252\340\270\247\340\270\261\340\270\252\340\270\224\340\270\265\340\270\204\340\271\210\340\270\260\n",
|
2000-10-04 14:23:09 +00:00
|
|
|
-1);
|
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE(texture));
|
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE(texture));
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 4);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE(texture));
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 7);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE(texture));
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 8);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2020-02-06 15:33:34 +00:00
|
|
|
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE(texture));
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 8);
|
2000-06-02 17:27:21 +00:00
|
|
|
iter2 = iter;
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter2, 10);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_blue", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter, 7);
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 10);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "bg_green", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter, 12);
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 10);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "bg_green", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter, 10);
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 15);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_red", &iter, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_blue", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter, 20);
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 20);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_red", &iter, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_blue", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_backward_chars (&iter, 25);
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 5);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_red", &iter, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_blue", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_iter_forward_chars (&iter, 15);
|
|
|
|
gtk_text_iter_backward_chars (&iter2, 10);
|
2000-06-02 17:27:21 +00:00
|
|
|
|
update to reflect text widget changes.
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c, gtk/testtextbuffer.c: update to reflect text
widget changes.
* gtk/gtktextview.h: To be consistent with usage of "line"
throughout the API to mean "newline-terminated thingy", change
MOVEMENT_LINE to be MOVEMENT_WRAPPED_LINE, and MOVEMENT_PARAGRAPH
to MOVEMENT_LINE.
(GtkTextView): Add flags for default editability, and whether to
show the cursor. Add functions to get/set that. Add
(gtk_text_view_get_iter_location): new function
* gtk/gtktexttypes.h: Move GtkTextLine typedef from here to
gtktextlayout.h
(g_convert): Add g_convert temporarily, will go in glib in a bit
* gtk/gtktexttagtable.h: include gtktexttag.h, and define
GtkTextTagTableForeach instead of brokenly using GHFunc.
Change gtk_text_tag_table_foreach() so it doesn't use GHFunc.
* gtk/gtktexttagprivate.h: Remove GtkTextStyleValues from here,
moved to public header.
* gtk/gtktexttag.h: Rename the "elide" attribute of tags to
"invisible", since "elide" was a bad name.
(gtk_text_tag_get_priority): Added
(GtkTextStyleValues): put this in public header, along with
functions to use it.
* gtk/gtktextmarkprivate.h: Include more headers, since we no
longer include gtktextbtree.h.
* gtk/gtktextmark.h: Add gtk_text_mark_ref, gtk_text_mark_unref,
gtk_text_mark_deleted
* gtk/gtktextlayout.h: Don't include the "really private" headers,
only buffer/iter. Forward declare GtkTextLIne and GtkTextLineData
to make this possible. Now we only need to install
gtktextlayout.h, not gtktextbtree.h and gtktext*private.h.
(However the Makefile.am isn't changed yet because of the
logistics of merging gtk-hp-patches piecemeal)
* gtk/gtktextiterprivate.h: include btree header, so it compiles;
rename gtk_text_iter_get_line to gtk_text_iter_get_text_line since
gtk_text_iter_get_line is now used in the public API for a
different purpose.
* gtk/gtktextiter.h: Clean up function names to be more
consistent. Always call char offset "offset" and byte index
"index". A "line" is always a line number.
(gtk_text_iter_is_last): new function, more efficient than
the existing way to check
(gtk_text_iter_is_first): new function, also more efficient
(gtk_text_iter_up_lines, gtk_text_iter_down_lines): Remove these
(gtk_text_iter_next_char, gtk_text_iter_prev_char): Renamed from
gtk_text_iter_forward_char, etc.
(gtk_text_iter_forward_to_tag_toggle): Renamed from
forward_find_tag_toggle, since this isn't a linear search
(GtkTextCharPredicate): rename from GtkTextViewCharPredicate
(gtk_text_iter_forward_search, gtk_text_iter_backward_search):
New functions, search for a buffer substring.
* gtk/gtktextbuffer.h: Add fields to store whether a paste is
interactive and default editable (since we need to store that info
until we receive the selection data).
Remove all the _at_char and at_line etc. versions of functions;
only have iterator versions.
Add _interactive() versions of functions, that consider the
editability of text. (FIXME add interactive flag to the
insert/delete signals per Darin's suggestion)
(gtk_text_buffer_get_tag_table): new function, demand-creates the
tag table if necessary
Remove declaration of gtk_text_buffer_get_iter_from_string
(_gtk_text_buffer_get_btree): private/internal function, added.
* gtk/gtktextbtree.h: Remove forward decl of GtkTextLineData.
(gtk_text_line_is_last): new function
2000-07-25 23:59:38 +00:00
|
|
|
gtk_text_buffer_remove_tag_by_name (buffer, "fg_red", &iter, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_remove_tag_by_name (buffer, "fg_blue", &iter, &iter2);
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
2000-10-04 14:23:09 +00:00
|
|
|
/* Put in tags that are just at the beginning, and just near the end,
|
|
|
|
* and just near the middle.
|
|
|
|
*/
|
2001-03-16 19:32:20 +00:00
|
|
|
tag = gtk_text_buffer_create_tag (buffer, "front_tag", NULL);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 3);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter2, 300);
|
|
|
|
|
2022-08-04 22:34:41 +00:00
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &iter, &iter2);
|
|
|
|
|
2001-03-16 19:32:20 +00:00
|
|
|
tag = gtk_text_buffer_create_tag (buffer, "end_tag", NULL);
|
2001-02-17 00:11:03 +00:00
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_iter_backward_chars (&iter2, 12);
|
|
|
|
iter = iter2;
|
|
|
|
gtk_text_iter_backward_chars (&iter, 157);
|
|
|
|
|
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &iter, &iter2);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-03-16 19:32:20 +00:00
|
|
|
tag = gtk_text_buffer_create_tag (buffer, "center_tag", NULL);
|
2000-10-04 14:23:09 +00:00
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter,
|
|
|
|
gtk_text_buffer_get_char_count (buffer)/2);
|
|
|
|
gtk_text_iter_backward_chars (&iter, 37);
|
|
|
|
iter2 = iter;
|
|
|
|
gtk_text_iter_forward_chars (&iter2, 57);
|
|
|
|
|
2022-08-04 22:34:41 +00:00
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &iter, &iter2);
|
2000-10-04 14:23:09 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_object_unref (pixbuf);
|
2017-11-30 04:22:13 +00:00
|
|
|
g_object_unref (texture);
|
2000-06-02 17:27:21 +00:00
|
|
|
}
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Line separator tests (initially to avoid regression on bugzilla #57428)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_line_separation (const char* str,
|
|
|
|
gboolean expect_next_line,
|
|
|
|
gboolean expect_end_iter,
|
|
|
|
int expected_line_count,
|
|
|
|
int expected_line_break,
|
|
|
|
int expected_next_line_start)
|
|
|
|
{
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextBuffer* buffer;
|
|
|
|
gboolean on_next_line;
|
|
|
|
gboolean on_end_iter;
|
2020-07-24 13:54:49 +00:00
|
|
|
int new_pos;
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, str, -1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, expected_line_break);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_ends_line (&iter) || gtk_text_iter_is_end (&iter));
|
2001-09-25 18:31:40 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (gtk_text_buffer_get_line_count (buffer), ==, expected_line_count);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
on_next_line = gtk_text_iter_forward_line (&iter);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (expect_next_line, ==, on_next_line);
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
on_end_iter = gtk_text_iter_is_end (&iter);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (on_end_iter == expect_end_iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
new_pos = gtk_text_iter_get_offset (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
if (on_next_line)
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (expected_next_line_start, ==, new_pos);
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
++expected_line_break;
|
|
|
|
while (expected_line_break < expected_next_line_start)
|
|
|
|
{
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, expected_line_break);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_iter_ends_line (&iter));
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
on_next_line = gtk_text_iter_forward_line (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (expect_next_line, ==, on_next_line);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
new_pos = gtk_text_iter_get_offset (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
if (on_next_line)
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (expected_next_line_start, ==, new_pos);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
++expected_line_break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME tests for backward line */
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_object_unref (buffer);
|
2001-09-25 18:31:40 +00:00
|
|
|
}
|
|
|
|
|
2006-04-05 18:30:46 +00:00
|
|
|
/* there are cases where \r and \n should not be treated like \r\n,
|
|
|
|
* originally bug #337022. */
|
|
|
|
static void
|
|
|
|
split_r_n_separators_test (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo\ra\nbar\n", -1);
|
|
|
|
|
|
|
|
/* delete 'a' so that we have
|
|
|
|
|
|
|
|
1 foo\r
|
|
|
|
2 \n
|
|
|
|
3 bar\n
|
|
|
|
|
|
|
|
* and both \r and \n are line separators */
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 5);
|
|
|
|
gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_ends_line (&iter));
|
2006-04-05 18:30:46 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 3);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_ends_line (&iter));
|
2009-08-30 01:29:57 +00:00
|
|
|
|
|
|
|
g_object_unref (buffer);
|
2006-04-05 18:30:46 +00:00
|
|
|
}
|
2001-09-25 18:31:40 +00:00
|
|
|
|
|
|
|
static void
|
2008-01-26 12:22:33 +00:00
|
|
|
test_line_separator (void)
|
2001-09-25 18:31:40 +00:00
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
char buf[7] = { '\0', };
|
|
|
|
|
|
|
|
/* Only one character has type G_UNICODE_PARAGRAPH_SEPARATOR in
|
|
|
|
* Unicode 3.0; update this if that changes.
|
|
|
|
*/
|
|
|
|
#define PARAGRAPH_SEPARATOR 0x2029
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
test_line_separation ("line", FALSE, TRUE, 1, 4, 4);
|
|
|
|
test_line_separation ("line\r\n", FALSE, TRUE, 2, 4, 6);
|
|
|
|
test_line_separation ("line\r", FALSE, TRUE, 2, 4, 5);
|
|
|
|
test_line_separation ("line\n", FALSE, TRUE, 2, 4, 5);
|
|
|
|
test_line_separation ("line\rqw", TRUE, FALSE, 2, 4, 5);
|
|
|
|
test_line_separation ("line\nqw", TRUE, FALSE, 2, 4, 5);
|
|
|
|
test_line_separation ("line\r\nqw", TRUE, FALSE, 2, 4, 6);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
g_unichar_to_utf8 (PARAGRAPH_SEPARATOR, buf);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 18:31:40 +00:00
|
|
|
str = g_strdup_printf ("line%s", buf);
|
|
|
|
test_line_separation (str, FALSE, TRUE, 2, 4, 5);
|
|
|
|
g_free (str);
|
|
|
|
str = g_strdup_printf ("line%sqw", buf);
|
|
|
|
test_line_separation (str, TRUE, FALSE, 2, 4, 5);
|
|
|
|
g_free (str);
|
2001-09-25 22:51:26 +00:00
|
|
|
|
2006-04-05 18:30:46 +00:00
|
|
|
split_r_n_separators_test ();
|
2001-09-25 22:51:26 +00:00
|
|
|
}
|
|
|
|
|
2009-08-30 01:29:57 +00:00
|
|
|
static void
|
|
|
|
test_backspace (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo", -1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 2);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (ret);
|
2009-08-30 01:29:57 +00:00
|
|
|
g_assert_cmpint (1, ==, gtk_text_iter_get_offset (&iter));
|
|
|
|
g_assert_cmpint (2, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo", -1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (!ret);
|
2009-08-30 01:29:57 +00:00
|
|
|
g_assert_cmpint (0, ==, gtk_text_iter_get_offset (&iter));
|
|
|
|
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
|
|
|
/* test bug #544724 */
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo\r\n\r\nbar", -1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 5);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (ret);
|
2009-08-30 01:29:57 +00:00
|
|
|
g_assert_cmpint (0, ==, gtk_text_iter_get_line (&iter));
|
|
|
|
g_assert_cmpint (8, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
2014-08-20 14:57:05 +00:00
|
|
|
/* test empty last line */
|
|
|
|
gtk_text_buffer_set_text (buffer, "", -1);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (ret);
|
2014-08-20 14:57:05 +00:00
|
|
|
g_assert_cmpint (0, ==, gtk_text_iter_get_offset (&iter));
|
|
|
|
g_assert_cmpint (0, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo\n", -1);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (ret);
|
2014-08-20 14:57:05 +00:00
|
|
|
g_assert_cmpint (3, ==, gtk_text_iter_get_offset (&iter));
|
|
|
|
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "foo\r\n", -1);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
|
|
|
ret = gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (ret);
|
2014-08-20 14:57:05 +00:00
|
|
|
g_assert_cmpint (3, ==, gtk_text_iter_get_offset (&iter));
|
|
|
|
g_assert_cmpint (3, ==, gtk_text_buffer_get_char_count (buffer));
|
|
|
|
|
2009-08-30 01:29:57 +00:00
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
static void
|
2008-01-26 12:22:33 +00:00
|
|
|
test_logical_motion (void)
|
2001-09-25 22:51:26 +00:00
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
char buf1[7] = { '\0', };
|
|
|
|
char buf2[7] = { '\0', };
|
|
|
|
char buf3[7] = { '\0', };
|
|
|
|
int expected[30];
|
|
|
|
int expected_steps;
|
|
|
|
int i;
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
#define LEADING_JAMO 0x1111
|
|
|
|
#define VOWEL_JAMO 0x1167
|
|
|
|
#define TRAILING_JAMO 0x11B9
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
g_unichar_to_utf8 (LEADING_JAMO, buf1);
|
|
|
|
g_unichar_to_utf8 (VOWEL_JAMO, buf2);
|
|
|
|
g_unichar_to_utf8 (TRAILING_JAMO, buf3);
|
|
|
|
|
|
|
|
/* Build the string "abc<leading><vowel><trailing>def\r\nxyz" */
|
|
|
|
str = g_strconcat ("abc", buf1, buf2, buf3, "def\r\nxyz", NULL);
|
|
|
|
gtk_text_buffer_set_text (buffer, str, -1);
|
|
|
|
g_free (str);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
/* Check cursor positions */
|
|
|
|
memset (expected, 0, sizeof (expected));
|
|
|
|
expected[0] = 0; /* before 'a' */
|
|
|
|
expected[1] = 1; /* before 'b' */
|
|
|
|
expected[2] = 2; /* before 'c' */
|
|
|
|
expected[3] = 3; /* before jamo */
|
|
|
|
expected[4] = 6; /* before 'd' */
|
|
|
|
expected[5] = 7; /* before 'e' */
|
|
|
|
expected[6] = 8; /* before 'f' */
|
|
|
|
expected[7] = 9; /* before '\r' */
|
|
|
|
expected[8] = 11; /* before 'x' */
|
|
|
|
expected[9] = 12; /* before 'y' */
|
|
|
|
expected[10] = 13; /* before 'z' */
|
2001-10-02 19:40:54 +00:00
|
|
|
expected[11] = 14; /* after 'z' (only matters going backward) */
|
2001-09-25 22:51:26 +00:00
|
|
|
expected_steps = 11;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
pos = gtk_text_iter_get_offset (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
if (pos != expected[i])
|
|
|
|
{
|
|
|
|
g_error ("Cursor position %d, expected %d",
|
|
|
|
pos, expected[i]);
|
|
|
|
}
|
|
|
|
|
2022-08-04 22:34:41 +00:00
|
|
|
++i;
|
2001-09-25 22:51:26 +00:00
|
|
|
}
|
|
|
|
while (gtk_text_iter_forward_cursor_position (&iter));
|
|
|
|
|
|
|
|
if (!gtk_text_iter_is_end (&iter))
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected to stop at the end iterator");
|
2001-10-03 20:49:10 +00:00
|
|
|
|
|
|
|
if (!gtk_text_iter_is_cursor_position (&iter))
|
|
|
|
g_error ("Should be a cursor position before the end iterator");
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
if (i != expected_steps)
|
|
|
|
g_error ("Expected %d steps, there were actually %d\n", expected_steps, i);
|
2001-09-25 22:51:26 +00:00
|
|
|
|
|
|
|
i = expected_steps;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
pos = gtk_text_iter_get_offset (&iter);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
if (pos != expected[i])
|
|
|
|
{
|
|
|
|
g_error ("Moving backward, cursor position %d, expected %d",
|
|
|
|
pos, expected[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* g_print ("%d = %d\n", pos, expected[i]); */
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-09-25 22:51:26 +00:00
|
|
|
--i;
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_backward_cursor_position (&iter));
|
|
|
|
|
|
|
|
if (i != -1)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected %d steps, there were actually %d", expected_steps - i, i);
|
2001-09-25 22:51:26 +00:00
|
|
|
|
|
|
|
if (!gtk_text_iter_is_start (&iter))
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected to stop at the start iterator");
|
2001-10-02 19:40:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Check sentence boundaries */
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
gtk_text_buffer_set_text (buffer, "Hi.\nHi. \nHi! Hi. Hi? Hi.", -1);
|
|
|
|
|
|
|
|
memset (expected, 0, sizeof (expected));
|
|
|
|
|
|
|
|
expected[0] = 0; /* before first Hi */
|
|
|
|
expected[1] = 3; /* After first . */
|
|
|
|
expected[2] = 7; /* After second . */
|
|
|
|
expected[3] = 12; /* After ! */
|
|
|
|
expected[4] = 16; /* After third . */
|
|
|
|
expected[5] = 20; /* After ? */
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
expected_steps = 6;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
pos = gtk_text_iter_get_offset (&iter);
|
|
|
|
|
|
|
|
if (pos != expected[i])
|
|
|
|
{
|
|
|
|
g_error ("Sentence position %d, expected %d",
|
|
|
|
pos, expected[i]);
|
|
|
|
}
|
|
|
|
|
2001-10-03 20:49:10 +00:00
|
|
|
if (i != 0 &&
|
|
|
|
!gtk_text_iter_is_end (&iter) &&
|
|
|
|
!gtk_text_iter_ends_sentence (&iter))
|
|
|
|
g_error ("Iterator at %d should end a sentence", pos);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_forward_sentence_end (&iter));
|
|
|
|
|
|
|
|
if (i != expected_steps)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected %d steps, there were actually %d", expected_steps, i);
|
2001-10-02 19:40:54 +00:00
|
|
|
|
|
|
|
if (!gtk_text_iter_is_end (&iter))
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected to stop at the end iterator");
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
gtk_text_buffer_set_text (buffer, "Hi.\nHi. \nHi! Hi. Hi? Hi.", -1);
|
|
|
|
|
|
|
|
memset (expected, 0, sizeof (expected));
|
|
|
|
|
|
|
|
expected[0] = 24;
|
2001-10-04 00:22:13 +00:00
|
|
|
expected[1] = 21;
|
2001-10-02 19:40:54 +00:00
|
|
|
expected[2] = 17;
|
2001-10-04 00:22:13 +00:00
|
|
|
expected[3] = 13;
|
2001-10-02 19:40:54 +00:00
|
|
|
expected[4] = 9;
|
|
|
|
expected[5] = 4;
|
|
|
|
expected[6] = 0;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
expected_steps = 7;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
pos = gtk_text_iter_get_offset (&iter);
|
|
|
|
|
|
|
|
if (pos != expected[i])
|
|
|
|
{
|
|
|
|
g_error ("Sentence position %d, expected %d",
|
|
|
|
pos, expected[i]);
|
|
|
|
}
|
|
|
|
|
2001-10-03 20:49:10 +00:00
|
|
|
if (pos != 0 &&
|
|
|
|
!gtk_text_iter_is_end (&iter) &&
|
|
|
|
!gtk_text_iter_starts_sentence (&iter))
|
|
|
|
g_error ("Iterator at %d should start a sentence", pos);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2001-10-02 19:40:54 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
while (gtk_text_iter_backward_sentence_start (&iter));
|
|
|
|
|
|
|
|
if (i != expected_steps)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected %d steps, there were actually %d", expected_steps, i);
|
2001-10-02 19:40:54 +00:00
|
|
|
|
|
|
|
if (gtk_text_iter_get_offset (&iter) != 0)
|
2016-02-28 17:22:55 +00:00
|
|
|
g_error ("Expected to stop at the start iterator");
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_object_unref (buffer);
|
2001-09-25 18:31:40 +00:00
|
|
|
}
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
static void
|
2008-01-26 12:22:33 +00:00
|
|
|
test_marks (void)
|
2007-05-26 04:10:42 +00:00
|
|
|
{
|
|
|
|
GtkTextBuffer *buf1, *buf2;
|
|
|
|
GtkTextMark *mark;
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
|
|
|
buf1 = gtk_text_buffer_new (NULL);
|
|
|
|
buf2 = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buf1, &iter);
|
|
|
|
mark = gtk_text_buffer_create_mark (buf1, "foo", &iter, TRUE);
|
|
|
|
g_object_ref (mark);
|
|
|
|
gtk_text_mark_set_visible (mark, TRUE);
|
|
|
|
gtk_text_buffer_delete_mark (buf1, mark);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_mark_get_visible (mark));
|
|
|
|
g_assert_true (gtk_text_mark_get_left_gravity (mark));
|
|
|
|
g_assert_cmpstr ("foo", ==, gtk_text_mark_get_name (mark));
|
|
|
|
g_assert_null (gtk_text_mark_get_buffer (mark));
|
|
|
|
g_assert_true (gtk_text_mark_get_deleted (mark));
|
|
|
|
g_assert_null (gtk_text_buffer_get_mark (buf1, "foo"));
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buf2, &iter);
|
|
|
|
gtk_text_buffer_add_mark (buf2, mark, &iter);
|
|
|
|
gtk_text_buffer_insert (buf2, &iter, "ewfwefwefwe", -1);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buf2, &iter, mark);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_mark_get_visible (mark));
|
|
|
|
g_assert_true (gtk_text_iter_is_start (&iter));
|
|
|
|
g_assert_true (gtk_text_mark_get_left_gravity (mark));
|
|
|
|
g_assert_cmpstr ("foo", ==, gtk_text_mark_get_name (mark));
|
|
|
|
g_assert_true (gtk_text_mark_get_buffer (mark) == buf2);
|
|
|
|
g_assert_false (gtk_text_mark_get_deleted (mark));
|
|
|
|
g_assert_true (gtk_text_buffer_get_mark (buf2, "foo") == mark);
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_delete_mark (buf2, mark);
|
|
|
|
gtk_text_mark_set_visible (mark, FALSE);
|
|
|
|
g_object_unref (mark);
|
|
|
|
|
|
|
|
mark = gtk_text_mark_new ("blah", TRUE);
|
|
|
|
gtk_text_buffer_get_start_iter (buf1, &iter);
|
|
|
|
gtk_text_mark_set_visible (mark, TRUE);
|
|
|
|
gtk_text_buffer_add_mark (buf1, mark, &iter);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_mark_get_visible (mark));
|
|
|
|
g_assert_true (gtk_text_mark_get_buffer (mark) == buf1);
|
|
|
|
g_assert_false (gtk_text_mark_get_deleted (mark));
|
|
|
|
g_assert_true (gtk_text_buffer_get_mark (buf1, "blah") == mark);
|
|
|
|
g_assert_cmpstr ("blah", ==, gtk_text_mark_get_name (mark));
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
gtk_text_mark_set_visible (mark, FALSE);
|
|
|
|
gtk_text_buffer_delete_mark (buf1, mark);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_mark_get_visible (mark));
|
|
|
|
g_assert_null (gtk_text_buffer_get_mark (buf1, "blah"));
|
|
|
|
g_assert_null (gtk_text_mark_get_buffer (mark));
|
|
|
|
g_assert_true (gtk_text_mark_get_deleted (mark));
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buf2, &iter);
|
|
|
|
gtk_text_buffer_add_mark (buf2, mark, &iter);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_mark_get_buffer (mark) == buf2);
|
|
|
|
g_assert_false (gtk_text_mark_get_deleted (mark));
|
|
|
|
g_assert_true (gtk_text_buffer_get_mark (buf2, "blah") == mark);
|
|
|
|
g_assert_cmpstr ("blah", ==, gtk_text_mark_get_name (mark));
|
2007-05-26 04:10:42 +00:00
|
|
|
|
|
|
|
g_object_unref (mark);
|
|
|
|
g_object_unref (buf1);
|
|
|
|
g_object_unref (buf2);
|
|
|
|
}
|
2008-01-26 12:22:33 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
test_utf8 (void)
|
|
|
|
{
|
|
|
|
gunichar ch;
|
|
|
|
|
|
|
|
/* Check UTF8 unknown char thing */
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_cmpint (GTK_TEXT_UNKNOWN_CHAR_UTF8_LEN, ==, 3);
|
|
|
|
g_assert_cmpint (g_utf8_strlen (gtk_text_unknown_char_utf8_gtk_tests_only (), 3), ==, 1);
|
2010-09-08 17:33:30 +00:00
|
|
|
ch = g_utf8_get_char (gtk_text_unknown_char_utf8_gtk_tests_only ());
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (ch == GTK_TEXT_UNKNOWN_CHAR);
|
2008-01-26 12:22:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_empty_buffer (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
int n;
|
|
|
|
GtkTextIter start;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
/* Check that buffer starts with one empty line and zero chars */
|
|
|
|
n = gtk_text_buffer_get_line_count (buffer);
|
|
|
|
if (n != 1)
|
|
|
|
g_error ("%d lines, expected 1", n);
|
|
|
|
|
|
|
|
n = gtk_text_buffer_get_char_count (buffer);
|
|
|
|
if (n != 0)
|
|
|
|
g_error ("%d chars, expected 0", n);
|
|
|
|
|
|
|
|
/* empty first line contains 0 chars */
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
n = gtk_text_iter_get_chars_in_line (&start);
|
|
|
|
if (n != 0)
|
|
|
|
g_error ("%d chars in first line, expected 0", n);
|
|
|
|
n = gtk_text_iter_get_bytes_in_line (&start);
|
|
|
|
if (n != 0)
|
|
|
|
g_error ("%d bytes in first line, expected 0", n);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
/* Run gruesome alien test suite on buffer */
|
|
|
|
run_tests (buffer);
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_get_set(void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
check_get_set_text (buffer, "Hello");
|
|
|
|
check_get_set_text (buffer, "Hello\n");
|
|
|
|
check_get_set_text (buffer, "Hello\r\n");
|
|
|
|
check_get_set_text (buffer, "Hello\r");
|
|
|
|
check_get_set_text (buffer, "Hello\nBar\nFoo");
|
|
|
|
check_get_set_text (buffer, "Hello\nBar\nFoo\n");
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_fill_empty (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
int n;
|
|
|
|
GtkTextIter start, end;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
/* Put stuff in the buffer */
|
|
|
|
fill_buffer (buffer);
|
|
|
|
|
|
|
|
/* Subject stuff-bloated buffer to further torment */
|
|
|
|
run_tests (buffer);
|
|
|
|
|
|
|
|
/* Delete all stuff from the buffer */
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
|
|
|
gtk_text_buffer_delete (buffer, &start, &end);
|
|
|
|
|
|
|
|
/* Check buffer for emptiness (note that a single
|
|
|
|
empty line always remains in the buffer) */
|
|
|
|
n = gtk_text_buffer_get_line_count (buffer);
|
|
|
|
if (n != 1)
|
|
|
|
g_error ("%d lines, expected 1", n);
|
|
|
|
|
|
|
|
n = gtk_text_buffer_get_char_count (buffer);
|
|
|
|
if (n != 0)
|
|
|
|
g_error ("%d chars, expected 0", n);
|
|
|
|
|
|
|
|
run_tests (buffer);
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_tag (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter start, end;
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
fill_buffer (buffer);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "adcdef", -1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, 1);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &end, 3);
|
|
|
|
gtk_text_buffer_apply_tag_by_name (buffer, "fg_blue", &start, &end);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
run_tests (buffer);
|
2022-08-04 22:34:41 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
static void
|
|
|
|
check_buffer_contents (GtkTextBuffer *buffer,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *contents)
|
2013-09-14 22:28:33 +00:00
|
|
|
{
|
|
|
|
GtkTextIter start;
|
|
|
|
GtkTextIter end;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *buffer_contents;
|
2013-09-14 22:28:33 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
buffer_contents = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
|
|
|
g_assert_cmpstr (buffer_contents, ==, contents);
|
2020-07-08 21:43:14 +00:00
|
|
|
g_free (buffer_contents);
|
2013-09-14 22:28:33 +00:00
|
|
|
}
|
|
|
|
|
2017-12-27 04:15:30 +00:00
|
|
|
static void
|
|
|
|
wait_for_changed (GtkTextBuffer *buffer)
|
|
|
|
{
|
|
|
|
GMainLoop *loop;
|
|
|
|
gulong id;
|
|
|
|
|
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
id = g_signal_connect_swapped (buffer, "changed", G_CALLBACK (g_main_loop_quit), loop);
|
|
|
|
g_main_loop_run (loop);
|
|
|
|
g_signal_handler_disconnect (buffer, id);
|
|
|
|
g_main_loop_unref (loop);
|
|
|
|
}
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
static void
|
|
|
|
test_clipboard (void)
|
|
|
|
{
|
2017-11-28 01:09:21 +00:00
|
|
|
GdkClipboard *clipboard;
|
2013-09-14 22:28:33 +00:00
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter start;
|
|
|
|
GtkTextIter end;
|
|
|
|
GtkTextTag *tag;
|
|
|
|
|
2017-11-28 01:09:21 +00:00
|
|
|
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
2013-09-14 22:28:33 +00:00
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
gtk_text_buffer_set_text (buffer, "abcdef", -1);
|
|
|
|
|
|
|
|
/* Simple cut & paste */
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &end, 3);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start, &end);
|
|
|
|
|
|
|
|
gtk_text_buffer_cut_clipboard (buffer, clipboard, TRUE);
|
|
|
|
check_buffer_contents (buffer, "def");
|
|
|
|
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
gtk_text_buffer_paste_clipboard (buffer, clipboard, &end, TRUE);
|
2017-12-27 04:15:30 +00:00
|
|
|
wait_for_changed (buffer);
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
check_buffer_contents (buffer, "defabc");
|
|
|
|
|
|
|
|
/* Simple copy & paste */
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, 3);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start, &end);
|
|
|
|
gtk_text_buffer_copy_clipboard (buffer, clipboard);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
gtk_text_buffer_paste_clipboard (buffer, clipboard, &start, TRUE);
|
2017-12-27 04:15:30 +00:00
|
|
|
wait_for_changed (buffer);
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
check_buffer_contents (buffer, "abcdefabc");
|
|
|
|
|
|
|
|
/* Replace the selection when pasting */
|
|
|
|
gtk_text_buffer_set_text (buffer, "abcdef", -1);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &end, 3);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start, &end);
|
|
|
|
gtk_text_buffer_copy_clipboard (buffer, clipboard);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, 3);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start, &end);
|
|
|
|
gtk_text_buffer_paste_clipboard (buffer, clipboard, NULL, TRUE);
|
2017-12-27 04:15:30 +00:00
|
|
|
wait_for_changed (buffer);
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
check_buffer_contents (buffer, "abcabc");
|
|
|
|
|
|
|
|
/* Copy & paste text with tags.
|
|
|
|
* See https://bugzilla.gnome.org/show_bug.cgi?id=339539
|
|
|
|
*/
|
|
|
|
gtk_text_buffer_set_text (buffer, "abcdef", -1);
|
|
|
|
|
|
|
|
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &end, 4);
|
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, 3);
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start, &end);
|
|
|
|
gtk_text_buffer_copy_clipboard (buffer, clipboard);
|
|
|
|
gtk_text_buffer_paste_clipboard (buffer, clipboard, NULL, TRUE);
|
2017-12-27 04:15:30 +00:00
|
|
|
wait_for_changed (buffer);
|
|
|
|
|
2013-09-14 22:28:33 +00:00
|
|
|
check_buffer_contents (buffer, "abcdef");
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, 3);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_forward_to_tag_toggle (&start, tag));
|
2013-09-14 22:28:33 +00:00
|
|
|
g_assert_cmpint (4, ==, gtk_text_iter_get_offset (&start));
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2015-11-12 16:43:32 +00:00
|
|
|
static void
|
|
|
|
test_get_iter (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter;
|
2020-07-24 13:54:49 +00:00
|
|
|
int offset;
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
/* ß takes 2 bytes in UTF-8 */
|
|
|
|
gtk_text_buffer_set_text (buffer, "ab\nßd\r\nef", -1);
|
|
|
|
|
|
|
|
/* Test get_iter_at_line() */
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 0));
|
|
|
|
g_assert_true (gtk_text_iter_is_start (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 1));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 3);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line (buffer, &iter, 2));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 7);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line (buffer, &iter, 3));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
/* Test get_iter_at_line_offset() */
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 0));
|
|
|
|
g_assert_true (gtk_text_iter_is_start (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 1));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 1);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 2));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 2);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 3));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 2);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 1, 1));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 4);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 1));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 8);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 2));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 2, 3));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 3, 1));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
/* Test get_iter_at_line_index() */
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 0));
|
|
|
|
g_assert_true (gtk_text_iter_is_start (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 1));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 1);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 2));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 2);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 0, 3));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 2);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 0));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 3);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 2));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 4);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 1, 3));
|
2015-11-12 16:43:32 +00:00
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 5);
|
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 2));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 2, 3));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_buffer_get_iter_at_line_index (buffer, &iter, 3, 1));
|
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
/* Test get_iter_at_offset() */
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_is_start (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
|
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 1);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 8);
|
|
|
|
offset = gtk_text_iter_get_offset (&iter);
|
|
|
|
g_assert_cmpint (offset, ==, 8);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_false (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 9);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 100);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, -1);
|
2021-04-12 20:12:25 +00:00
|
|
|
g_assert_true (gtk_text_iter_is_end (&iter));
|
2015-11-12 16:43:32 +00:00
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2021-12-03 16:02:48 +00:00
|
|
|
static void
|
|
|
|
test_iter_with_anchor (void)
|
|
|
|
{
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextChildAnchor *anchor;
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (gtk_text_view_new ());
|
|
|
|
buffer = gtk_text_view_get_buffer (text_view);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "ab\ncd\r\nef", -1);
|
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 1));
|
|
|
|
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
|
|
|
|
child = gtk_label_new ("text");
|
|
|
|
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
|
|
|
|
g_object_unref (child);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (buffer, &iter, anchor);
|
|
|
|
g_assert_cmpint (gtk_text_iter_get_char (&iter), ==, GTK_TEXT_UNKNOWN_CHAR);
|
|
|
|
|
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 1, 1));
|
|
|
|
/* ß takes 2 bytes in UTF-8 */
|
|
|
|
anchor = gtk_text_child_anchor_new_with_replacement ("ß");
|
|
|
|
gtk_text_buffer_insert_child_anchor (buffer, &iter, anchor);
|
|
|
|
child = gtk_label_new ("text");
|
|
|
|
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (buffer, &iter, anchor);
|
|
|
|
g_assert_cmpint (gtk_text_iter_get_char (&iter), ==, 223);
|
|
|
|
|
|
|
|
g_object_unref (child);
|
|
|
|
g_object_ref_sink (text_view);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_get_text_with_anchor (void)
|
|
|
|
{
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkTextIter iter, start, end;
|
|
|
|
GtkTextChildAnchor *anchor;
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (gtk_text_view_new ());
|
|
|
|
buffer = gtk_text_view_get_buffer (text_view);
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "ab\ncd\r\nef", -1);
|
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 0, 1));
|
|
|
|
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
|
|
|
|
child = gtk_label_new ("text");
|
|
|
|
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
|
|
|
|
g_object_unref (child);
|
|
|
|
|
|
|
|
g_assert_true (gtk_text_buffer_get_iter_at_line_offset (buffer, &iter, 1, 1));
|
|
|
|
/* ß takes 2 bytes in UTF-8 */
|
|
|
|
anchor = gtk_text_child_anchor_new_with_replacement ("ß");
|
|
|
|
gtk_text_buffer_insert_child_anchor (buffer, &iter, anchor);
|
|
|
|
child = gtk_label_new ("text");
|
|
|
|
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
|
|
|
g_assert_cmpstr (gtk_text_buffer_get_text (buffer, &start, &end, FALSE), ==, "ab\ncßd\r\nef");
|
|
|
|
|
|
|
|
g_object_unref (child);
|
|
|
|
g_object_ref_sink (text_view);
|
|
|
|
}
|
|
|
|
|
2021-05-26 10:07:46 +00:00
|
|
|
/* Check that basic undo works */
|
|
|
|
static void
|
|
|
|
test_undo0 (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
const char *text;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
g_assert_true (gtk_text_buffer_get_enable_undo (buffer));
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "text before", -1);
|
|
|
|
check_buffer_contents (buffer, "text before");
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
text = "The quick brown fox jumps over the lazy dog.";
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog.");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
text = "Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)";
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog."
|
|
|
|
"Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog.");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "text before");
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that bundling user actions works with history */
|
|
|
|
static void
|
|
|
|
test_undo1 (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
const char *text;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
g_assert_true (gtk_text_buffer_get_enable_undo (buffer));
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "text before", -1);
|
|
|
|
check_buffer_contents (buffer, "text before");
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_begin_user_action (buffer);
|
|
|
|
|
|
|
|
text = "The quick brown fox jumps over the lazy dog.";
|
|
|
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog.");
|
|
|
|
|
|
|
|
text = "Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)";
|
|
|
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog."
|
|
|
|
"Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)");
|
|
|
|
|
|
|
|
gtk_text_buffer_end_user_action (buffer);
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
check_buffer_contents (buffer, "text before");
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that irreversible actions work */
|
|
|
|
static void
|
|
|
|
test_undo2 (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
const char *text;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
g_assert_true (gtk_text_buffer_get_enable_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text (buffer, "text before", -1);
|
|
|
|
check_buffer_contents (buffer, "text before");
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
|
|
|
|
|
|
|
text = "The quick brown fox jumps over the lazy dog.";
|
|
|
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog.");
|
|
|
|
|
|
|
|
text = "Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)";
|
|
|
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
|
|
|
|
check_buffer_contents (buffer, "text before"
|
|
|
|
"The quick brown fox jumps over the lazy dog."
|
|
|
|
"Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)");
|
|
|
|
|
|
|
|
gtk_text_buffer_end_irreversible_action (buffer);
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2021-07-01 22:08:05 +00:00
|
|
|
/* Simulate typing, check that words get batched togethe */
|
|
|
|
static void
|
|
|
|
test_undo3 (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
const char *str;
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
|
|
|
|
|
|
|
str = "abc def. 122";
|
|
|
|
for (int i = 0; str[i]; i++)
|
|
|
|
gtk_text_buffer_insert_interactive_at_cursor (buffer, &str[i], 1, TRUE);
|
|
|
|
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &iter);
|
|
|
|
gtk_text_buffer_backspace (buffer, &iter, TRUE, TRUE);
|
|
|
|
gtk_text_buffer_insert_interactive_at_cursor (buffer, "3", 1, TRUE);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "abc def. 123");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "abc def. 12");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "abc def. 122");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "abc def.");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "abc");
|
|
|
|
g_assert_true (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
gtk_text_buffer_undo (buffer);
|
|
|
|
|
|
|
|
check_buffer_contents (buffer, "");
|
|
|
|
g_assert_false (gtk_text_buffer_get_can_undo (buffer));
|
|
|
|
|
|
|
|
g_object_unref (buffer);
|
|
|
|
}
|
|
|
|
|
2022-04-26 19:41:34 +00:00
|
|
|
static void
|
|
|
|
test_serialize_wrap_mode (void)
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer = gtk_text_buffer_new (NULL);
|
|
|
|
struct val {
|
|
|
|
GtkWrapMode mode;
|
|
|
|
const char *name;
|
|
|
|
} values[] = {
|
|
|
|
{ .mode = GTK_WRAP_NONE, .name = "none" },
|
|
|
|
{ .mode = GTK_WRAP_CHAR, .name = "char" },
|
|
|
|
{ .mode = GTK_WRAP_WORD, .name = "word" },
|
|
|
|
{ .mode = GTK_WRAP_WORD_CHAR, .name = "word-char" },
|
|
|
|
};
|
|
|
|
gsize i;
|
|
|
|
|
|
|
|
/* Four lines, each with a 2-byte run (digit plus newline) */
|
|
|
|
gtk_text_buffer_set_text (buffer, "0\n1\n2\n3\n", -1);
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (values); i++)
|
|
|
|
{
|
|
|
|
GtkTextTag *tag = gtk_text_buffer_create_tag (buffer, NULL, "wrap-mode", values[i].mode, NULL);
|
|
|
|
GtkTextIter start;
|
|
|
|
GtkTextIter end;
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &start, i * 2);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (buffer, &end, (i + 1) * 2);
|
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the attributes for each line run as a GVariant */
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (values); i++)
|
|
|
|
{
|
|
|
|
/* Each line has a { wrap-mode: name } run */
|
|
|
|
GVariantBuilder expected_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
|
|
|
g_variant_builder_add (&expected_builder, "{ss}", "wrap-mode", values[i].name);
|
|
|
|
|
|
|
|
GVariant *expected = g_variant_builder_end (&expected_builder);
|
|
|
|
|
|
|
|
GVariantBuilder result_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
|
|
|
int run_start, run_end;
|
|
|
|
|
|
|
|
gtk_text_buffer_get_run_attributes (buffer, &result_builder, 2 * i, &run_start, &run_end);
|
|
|
|
|
|
|
|
GVariant *result = g_variant_builder_end (&result_builder);
|
|
|
|
|
|
|
|
g_assert_cmpint (run_start, ==, 2 * i);
|
|
|
|
g_assert_cmpint (run_end, ==, 2 * (i + 1));
|
|
|
|
g_assert_cmpvariant (result, expected);
|
|
|
|
|
|
|
|
g_variant_unref (result);
|
|
|
|
g_variant_unref (expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_finalize_object (buffer);
|
|
|
|
}
|
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
int
|
|
|
|
main (int argc, char** argv)
|
|
|
|
{
|
|
|
|
/* First, we turn on btree debugging. */
|
2010-09-08 15:17:57 +00:00
|
|
|
gtk_set_debug_flags (gtk_get_debug_flags () | GTK_DEBUG_TEXT);
|
2008-01-26 12:22:33 +00:00
|
|
|
|
|
|
|
gtk_test_init (&argc, &argv);
|
|
|
|
|
|
|
|
g_test_add_func ("/TextBuffer/UTF8 unknown char", test_utf8);
|
|
|
|
g_test_add_func ("/TextBuffer/Line separator", test_line_separator);
|
2009-08-30 01:29:57 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Backspace", test_backspace);
|
2008-01-26 12:22:33 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Logical motion", test_logical_motion);
|
|
|
|
g_test_add_func ("/TextBuffer/Marks", test_marks);
|
|
|
|
g_test_add_func ("/TextBuffer/Empty buffer", test_empty_buffer);
|
|
|
|
g_test_add_func ("/TextBuffer/Get and Set", test_get_set);
|
|
|
|
g_test_add_func ("/TextBuffer/Fill and Empty", test_fill_empty);
|
|
|
|
g_test_add_func ("/TextBuffer/Tag", test_tag);
|
2013-09-14 22:28:33 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Clipboard", test_clipboard);
|
2015-11-12 16:43:32 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Get iter", test_get_iter);
|
2021-12-03 16:02:48 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Iter with anchor", test_iter_with_anchor);
|
|
|
|
g_test_add_func ("/TextBuffer/Get text with anchor", test_get_text_with_anchor);
|
2021-05-26 10:07:46 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Undo 0", test_undo0);
|
|
|
|
g_test_add_func ("/TextBuffer/Undo 1", test_undo1);
|
|
|
|
g_test_add_func ("/TextBuffer/Undo 2", test_undo2);
|
2021-07-01 22:08:05 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Undo 3", test_undo3);
|
2022-08-04 22:39:54 +00:00
|
|
|
g_test_add_func ("/TextBuffer/Serialize wrap-mode", test_serialize_wrap_mode);
|
2013-09-14 22:28:33 +00:00
|
|
|
|
2008-01-26 12:22:33 +00:00
|
|
|
return g_test_run();
|
|
|
|
}
|