Fixed priorities of brackets tags, so bold is really bold. For rule tags, apply style from context the match belongs to, not the rule's context.

This commit is contained in:
Yevgen Muntyan 2006-05-24 02:10:02 -05:00
parent ae8ae591c0
commit 8452643b9e
5 changed files with 40 additions and 8 deletions

View File

@ -236,19 +236,33 @@ create_tag (MooHighlighter *hl,
CtxNode *match_node,
MooRule *rule)
{
GtkTextTag *tag;
GtkTextTag *tag, *cbt = NULL, *ibt = NULL;
GtkTextTagTable *table;
if (!ctx_node->parent && !match_node && !rule)
return NULL;
tag = moo_syntax_tag_new (ctx_node, match_node, rule);
gtk_text_tag_table_add (gtk_text_buffer_get_tag_table (hl->buffer), tag);
table = gtk_text_buffer_get_tag_table (hl->buffer);
gtk_text_tag_table_add (table, tag);
g_object_unref (tag);
#if 1
/* XXX */
_moo_text_buffer_get_bracket_tags (MOO_TEXT_BUFFER (hl->buffer), &cbt, &ibt);
if (ibt)
gtk_text_tag_set_priority (ibt, gtk_text_tag_table_get_size (table) - 2);
if (cbt)
gtk_text_tag_set_priority (cbt, gtk_text_tag_table_get_size (table) - 1);
#endif
_moo_lang_set_tag_style (rule ? rule->context->lang : ctx_node->ctx->lang,
tag,
rule ? rule->context : ctx_node->ctx,
// rule ? rule->context : ctx_node->ctx,
ctx_node->ctx,
rule, NULL);
ctx_node->child_tags = g_slist_prepend (ctx_node->child_tags, tag);
@ -779,7 +793,8 @@ tag_set_scheme (G_GNUC_UNUSED gpointer whatever,
_moo_lang_erase_tag_style (GTK_TEXT_TAG (tag));
_moo_lang_set_tag_style (tag->rule ? tag->rule->context->lang : tag->ctx_node->ctx->lang,
GTK_TEXT_TAG (tag),
tag->rule ? tag->rule->context : tag->ctx_node->ctx,
// tag->rule ? tag->rule->context : tag->ctx_node->ctx,
tag->ctx_node->ctx,
tag->rule, scheme);
}
}

View File

@ -467,7 +467,7 @@ _moo_lang_set_tag_style (MooLang *lang,
{
g_return_if_fail (lang != NULL && GTK_IS_TEXT_TAG (tag));
g_return_if_fail (ctx != NULL && ctx->lang == lang);
g_return_if_fail (!rule || rule->context == ctx);
// g_return_if_fail (!rule || rule->context == ctx);
set_tag_style (lang, tag, ctx->style, scheme);

View File

@ -62,6 +62,9 @@ void _moo_text_buffer_tags_changed (MooTextBuffer *buffer,
int first,
int last);
gpointer _moo_text_buffer_get_undo_stack (MooTextBuffer *buffer);
void _moo_text_buffer_get_bracket_tags (MooTextBuffer *buffer,
GtkTextTag **correct,
GtkTextTag **incorrect);
G_END_DECLS

View File

@ -1313,6 +1313,20 @@ moo_text_buffer_set_bracket_mismatch_style (MooTextBuffer *buffer,
}
void
_moo_text_buffer_get_bracket_tags (MooTextBuffer *buffer,
GtkTextTag **correct,
GtkTextTag **incorrect)
{
g_return_if_fail (MOO_IS_TEXT_BUFFER (buffer));
if (correct)
*correct = buffer->priv->correct_match_tag;
if (incorrect)
*incorrect = buffer->priv->incorrect_match_tag;
}
static gboolean
parse_brackets (const char *string,
gunichar **left_brackets,

View File

@ -14,14 +14,14 @@ label: LaTeX
lang: LaTeX
command: shell
options: need-save
latex $name
${LATEX:-latex} $name
action: ViewDVI
label: View DVI
lang: LaTeX
command: shell
options: need-file, silent
kdvi $base.dvi &
ExecAsync('%s "%s.dvi"' % [$('LATEX_VIEWDVI', 'kdvi'), doc.base]);
##################################################################
# texinfo