Re: What is the meaning of toggle on/off for GtkTextTags?



Tadej,

Perfect, many thanks!
That's what should have gone into the manual in the first place!

The inclusion of 'toggle' in the name of these functions is unfortunate.
Toggle as a noun implies that the tag has more than one state. As far as I understand, tags are on until removed/deleted and cannot be disabled/enabled (correct?). 'Toggle' as a verb implies there is an agent toggling it, but again can tags be toggled?

It would seem the documentation uses the word 'toggle' as a substitute for 'starts' and 'ends'.

'gtk_text_iter_forward_to_tag_edge' would be more descriptive.

Again many thanks.
 

--- On Sat, 27/2/10, Tadej Borovšak <tadeboro gmail com> wrote:

From: Tadej Borovšak <tadeboro gmail com>
Subject: Re: What is the meaning of toggle on/off for GtkTextTags?
To: "Ken Resander" <kresander yahoo com>
Cc: gtk-list gnome org
Date: Saturday, 27 February, 2010, 1:08 AM

Hello.

The way I would interpret those function calls would be:

gtk_text_iter_forward_to_tag_toggle (iter, NULL);
  - Move iter to the start or end of any tag that comes next in buffer. If no
    tag start or end is found, move to the end of the buffer.

gtk_text_iter_forward_to_tag_toggle (iter, mytag);
  - Move iter to the start or end of mytag tag that comes next in buffer. If
    mytag is not present in buffer contents after initial iter, move to the end
    of the buffer.

Exactly the same thing applies for backward function. The only things that
changes is search direction.

Take this piece of markup as an example:
This is <em>important</em> piece of <b>bold and <c>colored</c></b> text.

Let say that our initial position is at character 'r' inside word 'important'.
gtk_text_iter_forward_to_tag_toggle (iter, NULL) call would move iter to </em>.
gtk_text_iter_forward_to_tag_toggle (iter, b) call would move iter to <b>.
gtk_text_iter_forward_to_tag_toggle (iter, x) call would move iter to the end.

(I substituted GtkTextTab with simple name in function calls from didactic
reasons.)

Hopefully things are clearer now.

Tadej

--
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com


Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]