Problem in GtkSourceBuffer text tagging (original) (raw)

I started to build an app for previewing Djot markup text while editing, the app is based on Gnome Text Editor. I’m using Djot’s javascript parser (launched within WebKitGtkWebView) to tag the text on the GtkSourceView, in order to highlight the source Djot text.

Here is the source code link, (branch appending_djot_previewer).

The problem is, when I’m trying to assign a new tag table (function defined here) to the GtkSourceView (parent instance of EditorDocument in this project), the GtkSourcebuffer is still tagging in markdown, not in Djot, and the following error apears:

(gnome-text-editor:2): Gtk-CRITICAL **: 22:59:42.086: set_table: assertion 'priv->tag_table == NULL' failed

Does anyone knows why and what that means? (As I understand this error apears when trying to set a new tag while there is already another tag named the same in the table, but I can’t find the place where it happens to disable it)

For example: *word* - is italic in Markdwn, but bold in Djot, and in the app it is showing italic, like in Markdown.

gwillems June 16, 2025, 10:28pm 3

Hi,

There was a similar question some time ago, have a look here: GtkSourceView with a custom highlighting engine for a custom language

You will have to make sure to disable the gtksourceview own highlighting (set GtkSource.Buffer:highlight-syntax to FALSE) before applying your custom tags.

I really don’t see where that could come from… Try setting the env variable G_DEBUG=fatal-criticals and launch the app in a debugger to get a call stack.