Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Mon, 13 Feb 2012 06:35:08 Commit: 589ffff377bdaa930bd4b547c98b8b84db3a46c9 https://github.com/geany/geany/commit/589ffff377bdaa930bd4b547c98b8b84db3a46...
Log Message: ----------- Add Scintilla wrapper function sci_set_lexer()
When the lexer is changed it clears all styling information and resets the folding state.
Closes #3486917 and #3486918
Modified Paths: -------------- src/highlighting.c src/sciwrappers.c src/sciwrappers.h
Modified: src/highlighting.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -872,7 +872,7 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer g_assert(ft_id != GEANY_FILETYPES_NONE);
/* lexer */ - SSM(sci, SCI_SETLEXER, lexer, 0); + sci_set_lexer(sci, lexer);
/* styles */ styleset_common(sci, ft_id); @@ -906,7 +906,7 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer
static void styleset_default(ScintillaObject *sci, guint ft_id) { - SSM(sci, SCI_SETLEXER, SCLEX_NULL, 0); + sci_set_lexer(sci, SCLEX_NULL);
/* we need to set STYLE_DEFAULT before we call SCI_STYLECLEARALL in styleset_common() */ set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_NONE, GCS_DEFAULT);
Modified: src/sciwrappers.c 7 files changed, 7 insertions(+), 0 deletions(-) =================================================================== @@ -529,6 +529,13 @@ gint sci_get_lexer(ScintillaObject *sci) }
+void sci_set_lexer(ScintillaObject *sci, guint lexer_id) +{ + SSM(sci, SCI_SETLEXER, lexer_id, 0); + SSM(sci, SCI_CLEARDOCUMENTSTYLE, 0, 0); +} + + /** Gets line length. * @param sci Scintilla widget. * @param line Line number.
Modified: src/sciwrappers.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -146,6 +146,7 @@
void sci_set_keywords (ScintillaObject *sci, guint k, const gchar *text); gint sci_get_lexer (ScintillaObject *sci); +void sci_set_lexer (ScintillaObject *sci, guint lexer_id); void sci_set_readonly (ScintillaObject *sci, gboolean readonly); gint sci_get_zoom (ScintillaObject *sci); void sci_send_command (ScintillaObject *sci, gint cmd);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).