Gedit 将括号(如 { 和 })进行匹配,并告诉我们匹配的左括号/右括号在哪里。如果超过 10000 个字符,它会显示“括号匹配超出范围”。如何扩展该范围?
我已获得最新版本的 Ubuntu,并且附带了 Gedit。
在这里https://github.com/jaseemabid/gedit我找到了 gedit-master/gedit/gedit-window.c,它在 ln.2236-2270 中说
static void
bracket_matched_cb (GtkSourceBuffer *buffer,
GtkTextIter *iter,
GtkSourceBracketMatchType result,
GeditWindow *window)
{
if (buffer != GTK_SOURCE_BUFFER (gedit_window_get_active_document (window)))
return;
switch (result)
{
case GTK_SOURCE_BRACKET_MATCH_NONE:
gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
window->priv->bracket_match_message_cid);
break;
case GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE:
gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
window->priv->bracket_match_message_cid,
_("Bracket match is out of range"));
break;
case GTK_SOURCE_BRACKET_MATCH_NOT_FOUND:
gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
window->priv->bracket_match_message_cid,
_("Bracket match not found"));
break;
case GTK_SOURCE_BRACKET_MATCH_FOUND:
gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
window->priv->bracket_match_message_cid,
_("Bracket match found on line: %d"),
gtk_text_iter_get_line (iter) + 1);
break;
default:
g_assert_not_reached ();
}
}
因此,如果结果是 GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE,我们就会收到此消息。我无法弄清楚 bracket_matched_cb 方法在哪里被调用,这是我目前得到的结果。