Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Mon, 15 May 2023 21:09:21 UTC
Commit: db5d7e5cac00de7f9e2aee48b05bde5397370dd2
https://github.com/geany/geany/commit/db5d7e5cac00de7f9e2aee48b05bde5397370…
Log Message:
-----------
Add a flag indicating whether to trust isFileScope from ctags
ctags treats unknown C/C++ file extensions as if they were source
files. Because of this, the isFileScope flag is incorrectly set
to TRUE for such files even if they are headers and the defined
tags don't have a file-only scope.
To fix this, we intorduce a flag called trust_file_scope which we
set to TRUE only when the source file name matches one of the
known C/C++ extensions.
For all other languages the flag is set to TRUE.
Modified Paths:
--------------
src/tagmanager/tm_source_file.c
src/tagmanager/tm_source_file.h
Modified: src/tagmanager/tm_source_file.c
19 lines changed, 19 insertions(+), 0 deletions(-)
===================================================================
@@ -609,6 +609,25 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_
else
source_file->lang = tm_ctags_get_named_lang(name);
+ source_file->trust_file_scope = TRUE;
+
+ if (source_file->lang == TM_PARSER_C || source_file->lang == TM_PARSER_CPP)
+ {
+ const gchar **ext;
+ const gchar *common_src_exts[] =
+ {".c", ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", ".CPP", ".CXX", NULL};
+
+ source_file->trust_file_scope = FALSE;
+ for (ext = common_src_exts; *ext; ext++)
+ {
+ if (g_str_has_suffix(source_file->short_name, *ext))
+ {
+ source_file->trust_file_scope = TRUE;
+ break;
+ }
+ }
+ }
+
return TRUE;
}
Modified: src/tagmanager/tm_source_file.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -35,6 +35,7 @@ typedef struct TMSourceFile
char *file_name; /**< Full file name (inc. path) */
char *short_name; /**< Just the name of the file (without the path) */
GPtrArray *tags_array; /**< Sorted tag array obtained by parsing the object. @elementtype{TMTag} */
+ gboolean trust_file_scope;
} TMSourceFile;
GType tm_source_file_get_type(void);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Fri, 06 Oct 2023 16:41:36 UTC
Commit: 4089741340522053319969975cebba19c3fce52b
https://github.com/geany/geany/commit/4089741340522053319969975cebba19c3fce…
Log Message:
-----------
Don't comment global content unless it is Conf
When using Tools->Config Files to open a user file that doesn't exist.
This fixes the first line of geany.css being wrongly uncommented
(and the rest unchanged) due to toggle comment being used and CSS
not having a line comment.
(Verbatim copy-paste of Nick's description of the previous version
of the patch, thanks :-)
Modified Paths:
--------------
src/ui_utils.c
Modified: src/ui_utils.c
11 lines changed, 2 insertions(+), 9 deletions(-)
===================================================================
@@ -2159,16 +2159,9 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
g_file_get_contents(global_file, &global_content, NULL, NULL);
doc = document_new_file(utf8_filename, ft, global_content);
- if (global_content)
+ if (global_content && doc->file_type->id == GEANY_FILETYPES_CONF)
{
- if (doc->file_type->id == GEANY_FILETYPES_CONF)
- comment_conf_files(doc->editor->sci);
- else
- {
- sci_select_all(doc->editor->sci);
- keybindings_send_command(GEANY_KEY_GROUP_FORMAT,
- GEANY_KEYS_FORMAT_COMMENTLINETOGGLE);
- }
+ comment_conf_files(doc->editor->sci);
sci_set_current_line(doc->editor->sci, 0);
document_set_text_changed(doc, FALSE);
sci_empty_undo_buffer(doc->editor->sci);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Sun, 10 Sep 2023 21:51:54 UTC
Commit: 0fbec848bb563692445bfadf3317701718527bf2
https://github.com/geany/geany/commit/0fbec848bb563692445bfadf3317701718527…
Log Message:
-----------
Fix keyword colorization on filetype change
When filetype is changed to a compatible filetype (such as C->C++ and
then possibly back to C), colorization is lost. It seems that with
Scintilla 5, when language-specific highlighting changes, SCI_SETKEYWORDS
has to be called again to take effect.
By setting keyword_hash to 0 we force Geany to call sci_set_keywords() in
document_highlight_tags() which fixes the problem.
Modified Paths:
--------------
src/document.c
Modified: src/document.c
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -2824,6 +2824,9 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type,
editor_set_indentation_guides(doc->editor);
build_menu_update(doc);
queue_colourise(doc);
+ /* forces re-setting SCI_SETKEYWORDS which seems to be needed with
+ * Scintilla 5 to colorize them properly */
+ doc->priv->keyword_hash = 0;
if (type->priv->symbol_list_sort_mode == SYMBOLS_SORT_USE_PREVIOUS)
doc->priv->symbol_list_sort_mode = interface_prefs.symbols_sort_mode;
else
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).