What exactly TextBuffer.apply_tag does?

Cant understand where should I use it from documentation:

Emits the “apply-tag” signal on buffer.

The default handler for the signal applies tag to the given range. start and end do not have to be in order.

I’m asking because everything works without, but I use GestureClick to catch the buffer area by x/y. It works not perfect yet (does not capture entire subject), so finding the reason…

Refer https://docs.gtk.org/gtk4/signal.TextBuffer.apply-tag.html.

In general, if there is a method which emits a signal, more details can be found in the signal documentation in the same page.

1 Like

This function will apply a GtkTextTag formatting to a slice of text.

You usually don’t need to connect to the apply-tag signal, unless you need to observe formatting changes. There is a default signal handler, internal to gtk, that will do the formatting for you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.