Hi all,
I'm working on a GtkTextBuffer subclass that needs to apply tags to to
newly inserted text. I've tried all sort of tricks to make this happen
automatically, but I am coming up short.
Basically the GtkTextView is editable and I'm trying to allow the user to
set a format and then start typ
What are tags applied to ?
In the apply tag function - what are the tags applied to.
On 13 Jun 2018 12:34, "Gary Kramlich" wrote:
>
> Hi all,
>
> I'm working on a GtkTextBuffer subclass that needs to apply tags to to
> newly inserted text. I've tried all sort of tricks to make this happen
> auto
I'm not sure I'm following your question unless you're trying to point out
that they're applied to GtkTextIter's that are invalidated once the text is
changed. That said, something is happening internally in the
`_gtk_text_btree` functions that implements the behavior I'm trying to
reproduce. If
Hi Gary,
Test setting up your callback with g_signal_connect_after. Then the location
iter should be at the end of the insert. Then the tag can be applied to the
inserted text.
Eric
//gcc -Wall highlight1.c -o highlight1 `pkg-config --cflags --libs gtk+-3.0`
#include
static gboolea
Hi Eric,
I meant to respond sooner but I've been busy. This worked like a charm!!
Thank you very much. Not sure how I overloaded
`gtk_text_iter_backward_chars` but yeah that made things way easier.
A followup I've been struggling with though is how to avoid applying this
formatting when rich te
The textview understands Pango markup. Maybe something to give a try. There are
a lot of text formats and you might have to do some text parsing depending on
the format. If it is possible to use gtk_text_buffer_insert_markup(), this can
save a lot of time dealing with text tags especially if
The formats I need to handle are HTML and Markdown, while I could convert
them to Pango markup, it seems redundant to do so. That said, I was
looking to be able to copy HTML back out from a buffer that's handling HTML
(by parsing it on insert).
I should note, as I haven't already, that my use cas
With the text buffer and tag table you can get the text with pango attributes
or even rebuild pango markup for print output. This allows the pango markup to
be parsed into and then to be extracted from the text buffer without
loss(Easier said than done). You only need one text buffer to m
I already have html parsing working into a Pango subset. The issue I have
right now is 100% related to the clipboard usage only. Right now I'm
parsing HTML on the text_insert, but i really only need to do it on paste.
Likewise for copy I need to parse the buffer and put html back onto the
clipboa