From 767cce068d2f5d8aa6844711fe241eb35c67f882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Tue, 20 Dec 2005 17:49:25 +0000 Subject: [PATCH] set cursor position between brackets in sci_cb_auto_close_bracket() git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@71 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- src/sci_cb.c | 9 ++++----- src/sci_cb.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sci_cb.c b/src/sci_cb.c index a00c8e67..47229666 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -158,13 +158,13 @@ on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user } case ' ': { // if and for autocompletion - sci_cb_auto_forif(sci, idx); + if (app->auto_complete_constructs) sci_cb_auto_forif(sci, idx); break; } case '[': case '{': { // Tex auto-closing - sci_cb_auto_close_bracket(sci, nt->ch); // Tex auto-closing + sci_cb_auto_close_bracket(sci, pos, nt->ch); // Tex auto-closing break; } case '}': @@ -242,7 +242,7 @@ void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line) } -void sci_cb_auto_close_bracket(ScintillaObject *sci, gchar c) +void sci_cb_auto_close_bracket(ScintillaObject *sci, gint pos, gchar c) { if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX) return; @@ -254,6 +254,7 @@ void sci_cb_auto_close_bracket(ScintillaObject *sci, gchar c) { sci_add_text(sci, "}"); } + sci_set_current_position(sci, pos); } @@ -408,8 +409,6 @@ void sci_cb_auto_forif(ScintillaObject *sci, gint idx) //gint line = sci_get_line_from_position(sci, pos); //gint start_style = SSM(sci, SCI_GETSTYLEAT, sci_get_position_from_line(sci, line), 0); - if (! app->auto_complete_constructs) return; - // only for C, C++, Java, Perl and PHP if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && diff --git a/src/sci_cb.h b/src/sci_cb.h index 310ebcda..89ed98dc 100644 --- a/src/sci_cb.h +++ b/src/sci_cb.h @@ -56,7 +56,7 @@ void sci_cb_auto_multiline(ScintillaObject *sci, gint pos); void sci_cb_auto_table(ScintillaObject *sci, gint pos); -void sci_cb_auto_close_bracket(ScintillaObject *sci, gchar c); +void sci_cb_auto_close_bracket(ScintillaObject *sci, gint pos, gchar c); #define sci_cb_html_entities "  " & < > Ü™ € • ∞ ∝ ∗\ − ∑ ∏ ∈ ∅ π Ω ω α ÿ ý\