lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
September 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
38 discussions
Start a n
N
ew thread
[geany/geany-plugins] 012769: Merge pull request #141 from scriptum/autoclose-v0.2.1
by Frank Lanitz
08 Sep '14
08 Sep '14
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Mon, 08 Sep 2014 18:07:07 UTC Commit: 012769274c4914636f8b5d1cf245116961c6a315
https://github.com/geany/geany-plugins/commit/012769274c4914636f8b5d1cf2451…
Log Message: ----------- Merge pull request #141 from scriptum/autoclose-v0.2.1 Autoclose v0.2.1 Modified Paths: -------------- autoclose/src/autoclose.c Modified: autoclose/src/autoclose.c 242 lines changed, 126 insertions(+), 116 deletions(-) =================================================================== @@ -43,19 +43,15 @@ GeanyPlugin *geany_plugin; GeanyData *geany_data; GeanyFunctions *geany_functions; -PLUGIN_VERSION_CHECK(216) +PLUGIN_VERSION_CHECK(218) PLUGIN_SET_TRANSLATABLE_INFO( LOCALEDIR, GETTEXT_PACKAGE, _("Auto-close"), _("Auto-close braces and brackets with lot of features"), - "0.2", + "0.3", "Pavel Roschin <rpg89(at)post(dot)ru>") -/* avoid aggresive warnings */ -#undef DOC_VALID -#define DOC_VALID(doc_ptr) (((doc_ptr) && (doc_ptr)->is_valid)) - typedef struct { /* close chars */ gboolean parenthesis; @@ -77,6 +73,7 @@ typedef struct { gboolean make_indent_for_cbracket; gboolean move_cursor_to_beginning; gboolean improved_cbracket_indent; + gboolean whitesmiths_style; gboolean close_functions; gboolean bcksp_remove_pair; gboolean jump_on_tab; @@ -87,7 +84,6 @@ typedef struct { static AutocloseInfo *ac_info = NULL; typedef struct { - gulong notify_handler[2]; /* used to place the caret after autoclosed items on tab (similar to eclipse) */ gint jump_on_tab; /* used to reset jump_on_tab when needed */ @@ -256,7 +252,7 @@ get_end_pos(ScintillaObject *sci, gint line) end = sci_get_line_end_position(sci, line); ch = char_at(sci, end - 1); /* ignore spaces and "}" */ - while(isspace_no_newline(ch) || '}' == ch) + while (isspace_no_newline(ch) || '}' == ch) { end--; ch = char_at(sci, end - 1); @@ -361,8 +357,17 @@ improve_indent( SSM(sci, SCI_ADDTEXT, 2, (sptr_t)"\n\n"); else SSM(sci, SCI_ADDTEXT, 3, (sptr_t)"\n\n}"); - sci_set_line_indentation(sci, line + 1, indent + indent_width); - sci_set_line_indentation(sci, line + 2, indent); + if (ac_info->whitesmiths_style) + { + sci_set_line_indentation(sci, line, indent); + sci_set_line_indentation(sci, line + 1, indent); + sci_set_line_indentation(sci, line + 2, indent); + } + else + { + sci_set_line_indentation(sci, line + 1, indent + indent_width); + sci_set_line_indentation(sci, line + 2, indent); + } /* move to the end of added line */ end_pos = sci_get_line_end_position(sci, line + 1); sci_set_current_position(sci, end_pos, TRUE); @@ -498,11 +503,17 @@ enclose_selection( start_indent = sci_get_line_indentation(sci, start_line); indent_width = editor_get_indent_prefs(editor)->width; sci_set_line_indentation(sci, start_line, start_indent); - sci_set_line_indentation(sci, start_line + 1, start_indent + indent_width); - for(i = start_line + 2; i <= end_line; i++) + if (!ac_info->whitesmiths_style) + sci_set_line_indentation(sci, start_line + 1, start_indent + indent_width); + else + sci_set_line_indentation(sci, start_line + 1, start_indent); + for (i = start_line + 2; i <= end_line; i++) { current_indent = sci_get_line_indentation(sci, i); - sci_set_line_indentation(sci, i, current_indent + indent_width); + if (!ac_info->whitesmiths_style) + sci_set_line_indentation(sci, i, current_indent + indent_width); + else + sci_set_line_indentation(sci, i, current_indent); } text_end_pos = sci_get_line_end_position(sci, i - 1); sci_set_current_position(sci, text_end_pos, FALSE); @@ -529,7 +540,7 @@ enclose_selection( /* looks like a forward loop but actually lines processed in reverse order */ for (i = 0; i < selections; i++) { - if(selection_is_up_down) + if (selection_is_up_down) line = selections - i - 1; else line = i; @@ -589,7 +600,7 @@ check_struct( gchar ch; gint line, len; ch = char_at(sci, pos - 1); - while(g_ascii_isspace(ch)) + while (g_ascii_isspace(ch)) { pos--; ch = char_at(sci, pos - 1); @@ -709,13 +720,15 @@ auto_close_chars( style = sci_get_style_at(sci, pos + lex_offset); /* add ; after functions */ - if (lexer_cpp_like(lexer, style) && - chars_left[0] == '(' && - !has_sel && - ac_info->close_functions && - pos == get_end_pos(sci, line) && - sci_get_line_indentation(sci, line) != 0 && - !check_define(sci, line)) + if ( + !has_sel && + ac_info->close_functions && + chars_left[0] == '(' && + lexer_cpp_like(lexer, style) && + pos == get_end_pos(sci, line) && + sci_get_line_indentation(sci, line) != 0 && + !check_define(sci, line) + ) chars_right[1] = ';'; style = sci_get_style_at(sci, pos); @@ -800,7 +813,6 @@ on_sci_notify(ScintillaObject *sci, gint scn, SCNotification *nt, gpointer user_ data->last_line = new_line; } - static void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data) { @@ -810,41 +822,15 @@ on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data) sci = doc->editor->sci; data = g_new0(AutocloseUserData, 1); - g_return_if_fail(data); data->doc = doc; - data->notify_handler[0] = g_signal_connect(G_OBJECT(sci), "sci-notify", - G_CALLBACK(on_sci_notify), data); - data->notify_handler[1] = g_signal_connect(G_OBJECT(sci), "key-press-event", - G_CALLBACK(on_key_press), data); + plugin_signal_connect(geany_plugin, G_OBJECT(sci), "sci-notify", + FALSE, G_CALLBACK(on_sci_notify), data); + plugin_signal_connect(geany_plugin, G_OBJECT(sci), "key-press-event", + FALSE, G_CALLBACK(on_key_press), data); /* This will free the data when the sci is destroyed */ g_object_set_data_full(G_OBJECT(sci), "autoclose-userdata", data, g_free); } -static void -autoclose_handlers_cleanup(void) -{ - gint i; - - foreach_document(i) - { - gint j; - gpointer data; - ScintillaObject *sci; - AutocloseUserData *autoclose_data; - - sci = documents[i]->editor->sci; - data = g_object_get_data(G_OBJECT(sci), "autoclose-userdata"); - if(!data) - continue; - autoclose_data = (AutocloseUserData*)data; - for(j = 0; j < 2; j++) - { - gulong handler = autoclose_data->notify_handler[j]; - g_signal_handler_disconnect(sci, handler); - } - } -} - PluginCallback plugin_callbacks[] = { { "document-open", (GCallback) &on_document_open, FALSE, NULL }, @@ -858,16 +844,15 @@ configure_response_cb(GtkDialog *dialog, gint response, gpointer user_data) if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY) return; GKeyFile *config = g_key_file_new(); - gchar *data; gchar *config_dir = g_path_get_dirname(ac_info->config_file); g_key_file_load_from_file(config, ac_info->config_file, G_KEY_FILE_NONE, NULL); -#define SAVE_CONF_BOOL(name) do { \ +#define SAVE_CONF_BOOL(name) G_STMT_START { \ ac_info->name = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( \ - g_object_get_data(G_OBJECT(dialog), "check_" #name))); \ + g_object_get_data(G_OBJECT(dialog), "check_" #name))); \ g_key_file_set_boolean(config, "autoclose", #name, ac_info->name); \ -} while (0) +} G_STMT_END SAVE_CONF_BOOL(parenthesis); SAVE_CONF_BOOL(abracket); @@ -887,6 +872,7 @@ configure_response_cb(GtkDialog *dialog, gint response, gpointer user_data) SAVE_CONF_BOOL(make_indent_for_cbracket); SAVE_CONF_BOOL(move_cursor_to_beginning); SAVE_CONF_BOOL(improved_cbracket_indent); + SAVE_CONF_BOOL(whitesmiths_style); SAVE_CONF_BOOL(close_functions); SAVE_CONF_BOOL(bcksp_remove_pair); SAVE_CONF_BOOL(jump_on_tab); @@ -901,6 +887,7 @@ configure_response_cb(GtkDialog *dialog, gint response, gpointer user_data) else { /* write config to file */ + gchar *data; data = g_key_file_to_data(config, NULL, NULL); utils_write_file(ac_info->config_file, data); g_free(data); @@ -914,6 +901,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *data) { guint i; + foreach_document(i) { on_document_open(NULL, documents[i], NULL); @@ -948,6 +936,7 @@ plugin_init(G_GNUC_UNUSED GeanyData *data) GET_CONF_BOOL(make_indent_for_cbracket, TRUE); GET_CONF_BOOL(move_cursor_to_beginning, TRUE); GET_CONF_BOOL(improved_cbracket_indent, TRUE); + GET_CONF_BOOL(whitesmiths_style, FALSE); GET_CONF_BOOL(close_functions, TRUE); GET_CONF_BOOL(bcksp_remove_pair, FALSE); GET_CONF_BOOL(jump_on_tab, TRUE); @@ -1020,95 +1009,100 @@ plugin_configure(GtkDialog *dialog) GtkWidget *widget, *vbox, *frame, *container, *scrollbox; vbox = gtk_vbox_new(FALSE, 0); scrollbox = gtk_scrolled_window_new(NULL, NULL); + gtk_widget_set_size_request(GTK_WIDGET(scrollbox), 350, 400); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollbox), vbox); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbox), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); -#define WIDGET_FRAME(description) do { \ +#define WIDGET_FRAME(description) G_STMT_START { \ container = gtk_vbox_new(FALSE, 0); \ frame = gtk_frame_new(NULL); \ - gtk_frame_set_label(GTK_FRAME(frame), _(description)); \ + gtk_frame_set_label(GTK_FRAME(frame), description); \ gtk_container_add(GTK_CONTAINER(frame), container); \ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 3); \ -} while (0) +} G_STMT_END -#define WIDGET_CONF_BOOL(name, description, tooltip) do { \ - widget = gtk_check_button_new_with_label(_(description)); \ - if (tooltip) gtk_widget_set_tooltip_text(widget, _(tooltip)); \ +#define WIDGET_CONF_BOOL(name, description, tooltip) G_STMT_START { \ + widget = gtk_check_button_new_with_label(description); \ + if (tooltip) gtk_widget_set_tooltip_text(widget, tooltip); \ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ac_info->name); \ gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 3); \ g_object_set_data(G_OBJECT(dialog), "check_" #name, widget); \ -} while (0) +} G_STMT_END - WIDGET_FRAME("Auto-close quotes and brackets"); - WIDGET_CONF_BOOL(parenthesis, "Parenthesis ( )", - "Auto-close parenthesis \"(\" -> \"(|)\""); + WIDGET_FRAME(_("Auto-close quotes and brackets")); + WIDGET_CONF_BOOL(parenthesis, _("Parenthesis ( )"), + _("Auto-close parenthesis \"(\" -> \"(|)\"")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_parenthesis_cb), dialog); - WIDGET_CONF_BOOL(cbracket, "Curly brackets { }", - "Auto-close curly brackets \"{\" -> \"{|}\""); + WIDGET_CONF_BOOL(cbracket, _("Curly brackets { }"), + _("Auto-close curly brackets \"{\" -> \"{|}\"")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_cbracket_cb), dialog); - WIDGET_CONF_BOOL(sbracket, "Square brackets [ ]", - "Auto-close square brackets \"[\" -> \"[|]\""); - WIDGET_CONF_BOOL(abracket, "Angular brackets < >", - "Auto-close angular brackets \"<\" -> \"<|>\""); + WIDGET_CONF_BOOL(sbracket, _("Square brackets [ ]"), + _("Auto-close square brackets \"[\" -> \"[|]\"")); + WIDGET_CONF_BOOL(abracket, _("Angular brackets < >"), + _("Auto-close angular brackets \"<\" -> \"<|>\"")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_abracket_htmlonly_cb), dialog); - WIDGET_CONF_BOOL(abracket_htmlonly, "\tOnly for HTML", - "Auto-close angular brackets only in HTML documents"); - WIDGET_CONF_BOOL(dquote, "Double quotes \" \"", - "Auto-close double quotes \" -> \"|\""); - WIDGET_CONF_BOOL(squote, "Single quotes \' \'", - "Auto-close single quotes ' -> '|'"); - WIDGET_CONF_BOOL(backquote, "Backquote ` `", - "Auto-close backquote ` -> `|`"); + WIDGET_CONF_BOOL(abracket_htmlonly, _("\tOnly for HTML"), + _("Auto-close angular brackets only in HTML documents")); + WIDGET_CONF_BOOL(dquote, _("Double quotes \" \""), + _("Auto-close double quotes \" -> \"|\"")); + WIDGET_CONF_BOOL(squote, _("Single quotes \' \'"), + _("Auto-close single quotes ' -> '|'")); + WIDGET_CONF_BOOL(backquote, _("Backquote ` `"), + _("Auto-close backquote ` -> `|`")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_backquote_bashonly_cb), dialog); - WIDGET_CONF_BOOL(backquote_bashonly, "\tOnly for Bash", - "Auto-close backquote only in Bash"); + WIDGET_CONF_BOOL(backquote_bashonly, _("\tOnly for Bash"), + _("Auto-close backquote only in Bash")); - WIDGET_FRAME("Improve curly brackets completion"); - WIDGET_CONF_BOOL(make_indent_for_cbracket, "Indent when enclosing", - "If you select some text and press \"{\" or \"}\", plugin " + WIDGET_FRAME(_("Improve curly brackets completion")); + WIDGET_CONF_BOOL(make_indent_for_cbracket, _("Indent when enclosing"), + _("If you select some text and press \"{\" or \"}\", plugin " "will auto-close selected lines and make new block with indent." "\nYou do not need to select block precisely - block enclosing " - "takes into account only lines."); + "takes into account only lines.")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_make_indent_for_cbracket_cb), dialog); - WIDGET_CONF_BOOL(move_cursor_to_beginning, "Move cursor to beginning", - "If you checked \"Indent when enclosing\", moving cursor " + WIDGET_CONF_BOOL(move_cursor_to_beginning, _("Move cursor to beginning"), + _("If you checked \"Indent when enclosing\", moving cursor " "to beginning may be useful: usually you make new block " - "and need to create new statement before this block."); - WIDGET_CONF_BOOL(improved_cbracket_indent, "Improved auto-indentation", - "Improved auto-indent for curly brackets: type \"{\" " + "and need to create new statement before this block.")); + WIDGET_CONF_BOOL(improved_cbracket_indent, _("Improved auto-indentation"), + _("Improved auto-indent for curly brackets: type \"{\" " "and then press Enter - plugin will create full indented block. " - "Works without \"auto-close { }\" checkbox."); + "Works without \"auto-close { }\" checkbox.")); + WIDGET_CONF_BOOL(whitesmiths_style, _("\tWhitesmiths style"), + _("This style puts the brace associated with a control statement on " + "the next line, indented. Statements within the braces are indented " + "to the same level as the braces.")); container = vbox; - WIDGET_CONF_BOOL(delete_pairing_brace, "Delete pairing character while backspacing first", - "Check if you want to delete pairing bracket by pressing BackSpace."); + WIDGET_CONF_BOOL(delete_pairing_brace, _("Delete pairing character while backspacing first"), + _("Check if you want to delete pairing bracket by pressing BackSpace.")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_delete_pairing_brace_cb), dialog); - WIDGET_CONF_BOOL(suppress_doubling, "Suppress double-completion", - "Check if you want to allow editor automatically fix mistypes " - "with brackets: if you type \"{}\" you will get \"{}\", not \"{}}\"."); - WIDGET_CONF_BOOL(enclose_selections, "Enclose selections", - "Automatically enclose selected text by pressing just one bracket key."); + WIDGET_CONF_BOOL(suppress_doubling, _("Suppress double-completion"), + _("Check if you want to allow editor automatically fix mistypes " + "with brackets: if you type \"{}\" you will get \"{}\", not \"{}}\".")); + WIDGET_CONF_BOOL(enclose_selections, _("Enclose selections"), + _("Automatically enclose selected text by pressing just one bracket key.")); g_signal_connect(widget, "toggled", G_CALLBACK(ac_enclose_selections_cb), dialog); - WIDGET_CONF_BOOL(keep_selection, "Keep selection when enclosing", - "Keep your previously selected text after enclosing."); + WIDGET_CONF_BOOL(keep_selection, _("Keep selection when enclosing"), + _("Keep your previously selected text after enclosing.")); - WIDGET_FRAME("Behaviour inside comments and strings"); - WIDGET_CONF_BOOL(comments_ac_enable, "Allow auto-closing in strings and comments", - "Check if you wan to keep auto-closing inside strings and comments too."); - WIDGET_CONF_BOOL(comments_enclose, "Enclose selections in strings and comments", - "Check if you wan to enclose selections inside strings and comments too."); + WIDGET_FRAME(_("Behaviour inside comments and strings")); + WIDGET_CONF_BOOL(comments_ac_enable, _("Allow auto-closing in strings and comments"), + _("Check if you wan to keep auto-closing inside strings and comments too.")); + WIDGET_CONF_BOOL(comments_enclose, _("Enclose selections in strings and comments"), + _("Check if you wan to enclose selections inside strings and comments too.")); container = vbox; - WIDGET_CONF_BOOL(close_functions, "Auto-complete \";\" for functions", - "Full function auto-closing (works only for C/C++): type \"sin(\" " - "and you will get \"sin(|);\"."); - WIDGET_CONF_BOOL(bcksp_remove_pair, "Shift+BackSpace removes pairing brace too", - "Remove left and right brace while pressing Shift+BackSpace.\nTip: " + WIDGET_CONF_BOOL(close_functions, _("Auto-complete \";\" for functions"), + _("Full function auto-closing (works only for C/C++): type \"sin(\" " + "and you will get \"sin(|);\".")); + WIDGET_CONF_BOOL(bcksp_remove_pair, _("Shift+BackSpace removes pairing brace too"), + _("Remove left and right brace while pressing Shift+BackSpace.\nTip: " "to completely remove indented block just Shift+BackSpace first \"{\" " - "or last \"}\"."); - WIDGET_CONF_BOOL(jump_on_tab, "Jump on Tab to enclosed char", - "Jump behind autoclosed items on Tab press."); + "or last \"}\".")); + WIDGET_CONF_BOOL(jump_on_tab, _("Jump on Tab to enclosed char"), + _("Jump behind autoclosed items on Tab press.")); #undef WIDGET_CONF_BOOL #undef WIDGET_FRAME @@ -1124,11 +1118,27 @@ plugin_configure(GtkDialog *dialog) return scrollbox; } +static void +autoclose_cleanup(void) +{ + guint i; + + foreach_document(i) + { + gpointer data; + ScintillaObject *sci; + + sci = documents[i]->editor->sci; + data = g_object_steal_data(G_OBJECT(sci), "autoclose-userdata"); + g_free(data); + } +} + /* Called by Geany before unloading the plugin. */ void plugin_cleanup(void) { - autoclose_handlers_cleanup(); + autoclose_cleanup(); g_free(ac_info->config_file); g_free(ac_info); } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] d790c6: Merge pull request #152 from scriptum/automark
by Frank Lanitz
08 Sep '14
08 Sep '14
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Mon, 08 Sep 2014 08:13:17 UTC Commit: d790c6285127b4a05d886e1c471af7d08384aa4f
https://github.com/geany/geany-plugins/commit/d790c6285127b4a05d886e1c471af…
Log Message: ----------- Merge pull request #152 from scriptum/automark Automark: remove global vars, simple search, disable plugin while selection Modified Paths: -------------- automark/src/automark.c Modified: automark/src/automark.c 37 lines changed, 22 insertions(+), 15 deletions(-) =================================================================== @@ -51,8 +51,6 @@ PLUGIN_SET_TRANSLATABLE_INFO( "Pavel Roschin <rpg89(at)post(dot)ru>") static gint source_id; -static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0}; -static GeanyEditor *editor_cache = NULL; static const gint AUTOMARK_INDICATOR = GEANY_INDICATOR_SEARCH; @@ -62,7 +60,9 @@ search_mark_in_range( gint flags, struct Sci_TextToFind *ttf) { - while (SSM(editor->sci, SCI_FINDTEXT, flags, (uptr_t)ttf) != -1) + ScintillaObject *sci = editor->sci; + + while (SSM(sci, SCI_FINDTEXT, flags, (uptr_t)ttf) != -1) { gint start = ttf->chrgText.cpMin; gint end = ttf->chrgText.cpMax; @@ -71,11 +71,12 @@ search_mark_in_range( break; ttf->chrg.cpMin = ttf->chrgText.cpMax; - if (end != start) - { - SSM(editor->sci, SCI_SETINDICATORCURRENT, AUTOMARK_INDICATOR, 0); - SSM(editor->sci, SCI_INDICATORFILLRANGE, start, end - start); - } + if (end == start) + continue; + if(SSM(sci, SCI_INDICATORVALUEAT, AUTOMARK_INDICATOR, start)) + continue; + SSM(sci, SCI_SETINDICATORCURRENT, AUTOMARK_INDICATOR, 0); + SSM(sci, SCI_INDICATORFILLRANGE, start, end - start); } } @@ -86,7 +87,7 @@ get_current_word(ScintillaObject *sci, gchar *word, gsize wordlen) gint pos = sci_get_current_position(sci); gint start = SSM(sci, SCI_WORDSTARTPOSITION, pos, TRUE); gint end = SSM(sci, SCI_WORDENDPOSITION, pos, TRUE); - + if (start == end) *word = 0; else @@ -100,12 +101,14 @@ get_current_word(ScintillaObject *sci, gchar *word, gsize wordlen) static gboolean automark(gpointer user_data) { - GeanyDocument *doc = (GeanyDocument *)user_data; - GeanyEditor *editor = doc->editor; - ScintillaObject *sci = editor->sci; - gchar text[GEANY_MAX_WORD_LENGTH]; - gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; - struct Sci_TextToFind ttf; + GeanyDocument *doc = (GeanyDocument *)user_data; + GeanyEditor *editor = doc->editor; + static GeanyEditor *editor_cache = NULL; + ScintillaObject *sci = editor->sci; + gchar text[GEANY_MAX_WORD_LENGTH]; + static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0}; + gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; + struct Sci_TextToFind ttf; source_id = 0; @@ -113,6 +116,10 @@ automark(gpointer user_data) if (!DOC_VALID(doc)) return FALSE; + /* Do not highlight while selecting text and allow other markers to work */ + if (sci_has_selection(sci)) + return FALSE; + get_current_word(editor->sci, text, sizeof(text)); if (!*text) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 3af500: Automark: remove global vars, simple search, disable plugin while selection
by Pavel Roschin
06 Sep '14
06 Sep '14
Branch: refs/heads/master Author: Pavel Roschin <roshin(a)scriptumplus.ru> Committer: Pavel Roschin <roshin(a)scriptumplus.ru> Date: Sat, 06 Sep 2014 18:33:51 UTC Commit: 3af5005bdce6f93db89d27a1638cb7e73496b7d8
https://github.com/geany/geany-plugins/commit/3af5005bdce6f93db89d27a1638cb…
Log Message: ----------- Automark: remove global vars, simple search, disable plugin while selection Modified Paths: -------------- automark/src/automark.c Modified: automark/src/automark.c 37 lines changed, 22 insertions(+), 15 deletions(-) =================================================================== @@ -51,8 +51,6 @@ PLUGIN_SET_TRANSLATABLE_INFO( "Pavel Roschin <rpg89(at)post(dot)ru>") static gint source_id; -static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0}; -static GeanyEditor *editor_cache = NULL; static const gint AUTOMARK_INDICATOR = GEANY_INDICATOR_SEARCH; @@ -62,7 +60,9 @@ search_mark_in_range( gint flags, struct Sci_TextToFind *ttf) { - while (SSM(editor->sci, SCI_FINDTEXT, flags, (uptr_t)ttf) != -1) + ScintillaObject *sci = editor->sci; + + while (SSM(sci, SCI_FINDTEXT, flags, (uptr_t)ttf) != -1) { gint start = ttf->chrgText.cpMin; gint end = ttf->chrgText.cpMax; @@ -71,11 +71,12 @@ search_mark_in_range( break; ttf->chrg.cpMin = ttf->chrgText.cpMax; - if (end != start) - { - SSM(editor->sci, SCI_SETINDICATORCURRENT, AUTOMARK_INDICATOR, 0); - SSM(editor->sci, SCI_INDICATORFILLRANGE, start, end - start); - } + if (end == start) + continue; + if(SSM(sci, SCI_INDICATORVALUEAT, AUTOMARK_INDICATOR, start)) + continue; + SSM(sci, SCI_SETINDICATORCURRENT, AUTOMARK_INDICATOR, 0); + SSM(sci, SCI_INDICATORFILLRANGE, start, end - start); } } @@ -86,7 +87,7 @@ get_current_word(ScintillaObject *sci, gchar *word, gsize wordlen) gint pos = sci_get_current_position(sci); gint start = SSM(sci, SCI_WORDSTARTPOSITION, pos, TRUE); gint end = SSM(sci, SCI_WORDENDPOSITION, pos, TRUE); - + if (start == end) *word = 0; else @@ -100,12 +101,14 @@ get_current_word(ScintillaObject *sci, gchar *word, gsize wordlen) static gboolean automark(gpointer user_data) { - GeanyDocument *doc = (GeanyDocument *)user_data; - GeanyEditor *editor = doc->editor; - ScintillaObject *sci = editor->sci; - gchar text[GEANY_MAX_WORD_LENGTH]; - gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; - struct Sci_TextToFind ttf; + GeanyDocument *doc = (GeanyDocument *)user_data; + GeanyEditor *editor = doc->editor; + static GeanyEditor *editor_cache = NULL; + ScintillaObject *sci = editor->sci; + gchar text[GEANY_MAX_WORD_LENGTH]; + static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0}; + gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; + struct Sci_TextToFind ttf; source_id = 0; @@ -113,6 +116,10 @@ automark(gpointer user_data) if (!DOC_VALID(doc)) return FALSE; + /* Do not highlight while selecting text and allow other markers to work */ + if (sci_has_selection(sci)) + return FALSE; + get_current_word(editor->sci, text, sizeof(text)); if (!*text) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] dd87a7: GeanyLua Fix some compiler warnings
by Matthew Brush
04 Sep '14
04 Sep '14
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Matthew Brush <matt(a)geany.org> Date: Wed, 21 May 2014 03:23:03 UTC Commit: dd87a7ba226a36eeb6c601b806e7d3f0b0f3badd
https://github.com/geany/geany-plugins/commit/dd87a7ba226a36eeb6c601b806e7d…
Log Message: ----------- GeanyLua Fix some compiler warnings * Replace shadowed "app" variable name with still quite short "geany->app" and avoid the variable altogether. * Avoid re-defining C99 "isblank()" function/macro by renaming to "is_blank()". Could add some pre-processor checks and only define "isblank" pre-C99 but this behaves same as before I think. * Avoid storing allocated string in SciTextToFind's const member since it needs to be passed to g_free() later. Temp var used to store non-const pointer but could instead add a cast in the g_free() call but I find this a little cleaner somehow. Modified Paths: -------------- geanylua/glspi_app.c geanylua/glspi_init.c geanylua/glspi_sci.c Modified: geanylua/glspi_app.c 12 lines changed, 5 insertions(+), 7 deletions(-) =================================================================== @@ -77,13 +77,11 @@ static const gchar *glspi_script_dir = NULL; static gint glspi_appinfo(lua_State* L) { - GeanyApp *app = geany->app; - lua_newtable(L); - SetTableBool("debug", app->debug_mode); - SetTableStr("configdir", app->configdir); - SetTableStr("datadir", app->datadir); - SetTableStr("docdir", app->docdir); + SetTableBool("debug", geany->app->debug_mode); + SetTableStr("configdir", geany->app->configdir); + SetTableStr("datadir", geany->app->datadir); + SetTableStr("docdir", geany->app->docdir); SetTableStr("scriptdir", glspi_script_dir); lua_pushstring(L,"template"); glspi_template(L); @@ -93,7 +91,7 @@ static gint glspi_appinfo(lua_State* L) glspi_tools(L); lua_rawset(L,1); - if (app->project) { + if (geany->app->project) { lua_pushstring(L,"project"); glspi_project(L); lua_rawset(L,1); Modified: geanylua/glspi_init.c 35 lines changed, 17 insertions(+), 18 deletions(-) =================================================================== @@ -264,7 +264,8 @@ static void menu_item_activate(GtkMenuItem * menuitem, gpointer gdata) } -#define isblank(c) ( (c==32) || (c==9) ) +#define is_blank(c) ( (c==32) || (c==9) ) + /* Check if the script file begins with a special comment in the form: @@ -282,15 +283,15 @@ static void assign_accel(GtkWidget*w, char*fn) if (len>0) { gchar*p1=buf; buf[len]='\0'; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"--", 2) == 0 ) { p1+=2; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"@ACCEL@", 7) == 0 ) { guint key=0; GdkModifierType mods=0; p1+=7; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if (*p1) { gchar*p2=p1; while ( (*p2) && (!isspace(*p2)) ) { p2++; } @@ -408,14 +409,12 @@ static gchar *get_data_dir(void) PLUGIN_EXPORT void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin) { - GeanyApp *app = data->app; - glspi_geany_data = data; glspi_geany_functions = functions; glspi_geany_plugin = plugin; local_data.script_dir = - g_strconcat(app->configdir, USER_SCRIPT_FOLDER, NULL); + g_strconcat(geany->app->configdir, USER_SCRIPT_FOLDER, NULL); if (!g_file_test(local_data.script_dir, G_FILE_TEST_IS_DIR)) { gchar *datadir = get_data_dir(); @@ -424,30 +423,30 @@ void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin g_build_path(G_DIR_SEPARATOR_S, datadir, "geany-plugins", "geanylua", NULL); g_free(datadir); } - if (app->debug_mode) { + if (geany->app->debug_mode) { g_printerr(_(" ==>> %s: Building menu from '%s'\n"), PLUGIN_NAME, local_data.script_dir); } local_data.on_saved_script = - g_strconcat(app->configdir, ON_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_SAVED_SCRIPT, NULL); local_data.on_opened_script = - g_strconcat(app->configdir, ON_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_OPENED_SCRIPT, NULL); local_data.on_created_script = - g_strconcat(app->configdir, ON_CREATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CREATED_SCRIPT, NULL); local_data.on_activated_script = - g_strconcat(app->configdir, ON_ACTIVATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_ACTIVATED_SCRIPT, NULL); local_data.on_init_script = - g_strconcat(app->configdir, ON_INIT_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_INIT_SCRIPT, NULL); local_data.on_cleanup_script = - g_strconcat(app->configdir, ON_CLEANUP_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CLEANUP_SCRIPT, NULL); local_data.on_configure_script = - g_strconcat(app->configdir, ON_CONFIGURE_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CONFIGURE_SCRIPT, NULL); local_data.on_proj_opened_script = - g_strconcat(app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); local_data.on_proj_saved_script = - g_strconcat(app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); local_data.on_proj_closed_script = - g_strconcat(app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL); glspi_set_sci_cmd_hash(TRUE); glspi_set_key_cmd_hash(TRUE); Modified: geanylua/glspi_sci.c 8 lines changed, 5 insertions(+), 3 deletions(-) =================================================================== @@ -758,6 +758,7 @@ static gint glspi_find(lua_State* L) gint flags=0; gint i,n; + gchar *text; DOC_REQUIRED switch (lua_gettop(L)) { case 0:return FAIL_STRING_ARG(1); @@ -771,7 +772,8 @@ static gint glspi_find(lua_State* L) if (!lua_isnumber(L,3)) { return FAIL_NUMERIC_ARG(3); } if (!lua_istable(L,4)) { return FAIL_TABLE_ARG(4); } - ttf.lpstrText=g_strdup(lua_tostring(L,1)); + text=g_strdup(lua_tostring(L,1)); + ttf.lpstrText=text; ttf.chrg.cpMin=lua_tonumber(L,2); ttf.chrg.cpMax=lua_tonumber(L,3); @@ -805,10 +807,10 @@ static gint glspi_find(lua_State* L) if (scintilla_send_message(doc->editor->sci,SCI_FINDTEXT,flags,(sptr_t)&ttf)!=-1) { push_number(L,ttf.chrgText.cpMin); push_number(L,ttf.chrgText.cpMax); - g_free(ttf.lpstrText); + g_free(text); return 2; } else { - g_free(ttf.lpstrText); + g_free(text); return 0; } } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 307880: Use single <geanyplugin.h> that provides everything needed
by Matthew Brush
04 Sep '14
04 Sep '14
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Matthew Brush <matt(a)geany.org> Date: Wed, 21 May 2014 03:29:01 UTC Commit: 307880c0778e27d191305ec6c68355af2512d1d4
https://github.com/geany/geany-plugins/commit/307880c0778e27d191305ec6c6835…
Log Message: ----------- Use single <geanyplugin.h> that provides everything needed Modified Paths: -------------- geanylua/geanylua.c geanylua/glspi.h Modified: geanylua/geanylua.c 9 lines changed, 1 insertions(+), 8 deletions(-) =================================================================== @@ -35,14 +35,7 @@ #endif -#include "geany.h" -#include "plugindata.h" -#include "keybindings.h" -#include "ui_utils.h" - -#include "geanyfunctions.h" - -#include <glib/gi18n.h> +#include <geanyplugin.h> #include "glspi_ver.h" Modified: geanylua/glspi.h 15 lines changed, 1 insertions(+), 14 deletions(-) =================================================================== @@ -16,20 +16,7 @@ #include <string.h> #include <ctype.h> -#include "geany.h" -#include "plugindata.h" - -#include "prefs.h" -#include "project.h" -#include "support.h" -#include "document.h" -#include "filetypes.h" -#include "keybindings.h" -#include "ui_utils.h" -#include "editor.h" -#include "templates.h" - -#include "geanyfunctions.h" +#include <geanyplugin.h> #define main_widgets geany->main_widgets #include "glspi_ver.h" -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] cd5bd3: Merge pull request #149 from codebrainz/geanylua-fixups
by Frank Lanitz
04 Sep '14
04 Sep '14
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Wed, 03 Sep 2014 22:45:19 UTC Commit: cd5bd3b5e2ce64e2457317c963aa9402b36138f2
https://github.com/geany/geany-plugins/commit/cd5bd3b5e2ce64e2457317c963aa9…
Log Message: ----------- Merge pull request #149 from codebrainz/geanylua-fixups Minor GeanyLua fixups Modified Paths: -------------- geanylua/geanylua.c geanylua/glspi.h geanylua/glspi_app.c geanylua/glspi_init.c geanylua/glspi_sci.c Modified: geanylua/geanylua.c 9 lines changed, 1 insertions(+), 8 deletions(-) =================================================================== @@ -35,14 +35,7 @@ #endif -#include "geany.h" -#include "plugindata.h" -#include "keybindings.h" -#include "ui_utils.h" - -#include "geanyfunctions.h" - -#include <glib/gi18n.h> +#include <geanyplugin.h> #include "glspi_ver.h" Modified: geanylua/glspi.h 15 lines changed, 1 insertions(+), 14 deletions(-) =================================================================== @@ -16,20 +16,7 @@ #include <string.h> #include <ctype.h> -#include "geany.h" -#include "plugindata.h" - -#include "prefs.h" -#include "project.h" -#include "support.h" -#include "document.h" -#include "filetypes.h" -#include "keybindings.h" -#include "ui_utils.h" -#include "editor.h" -#include "templates.h" - -#include "geanyfunctions.h" +#include <geanyplugin.h> #define main_widgets geany->main_widgets #include "glspi_ver.h" Modified: geanylua/glspi_app.c 12 lines changed, 5 insertions(+), 7 deletions(-) =================================================================== @@ -77,13 +77,11 @@ static const gchar *glspi_script_dir = NULL; static gint glspi_appinfo(lua_State* L) { - GeanyApp *app = geany->app; - lua_newtable(L); - SetTableBool("debug", app->debug_mode); - SetTableStr("configdir", app->configdir); - SetTableStr("datadir", app->datadir); - SetTableStr("docdir", app->docdir); + SetTableBool("debug", geany->app->debug_mode); + SetTableStr("configdir", geany->app->configdir); + SetTableStr("datadir", geany->app->datadir); + SetTableStr("docdir", geany->app->docdir); SetTableStr("scriptdir", glspi_script_dir); lua_pushstring(L,"template"); glspi_template(L); @@ -93,7 +91,7 @@ static gint glspi_appinfo(lua_State* L) glspi_tools(L); lua_rawset(L,1); - if (app->project) { + if (geany->app->project) { lua_pushstring(L,"project"); glspi_project(L); lua_rawset(L,1); Modified: geanylua/glspi_init.c 35 lines changed, 17 insertions(+), 18 deletions(-) =================================================================== @@ -264,7 +264,8 @@ static void menu_item_activate(GtkMenuItem * menuitem, gpointer gdata) } -#define isblank(c) ( (c==32) || (c==9) ) +#define is_blank(c) ( (c==32) || (c==9) ) + /* Check if the script file begins with a special comment in the form: @@ -282,15 +283,15 @@ static void assign_accel(GtkWidget*w, char*fn) if (len>0) { gchar*p1=buf; buf[len]='\0'; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"--", 2) == 0 ) { p1+=2; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"@ACCEL@", 7) == 0 ) { guint key=0; GdkModifierType mods=0; p1+=7; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if (*p1) { gchar*p2=p1; while ( (*p2) && (!isspace(*p2)) ) { p2++; } @@ -408,14 +409,12 @@ static gchar *get_data_dir(void) PLUGIN_EXPORT void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin) { - GeanyApp *app = data->app; - glspi_geany_data = data; glspi_geany_functions = functions; glspi_geany_plugin = plugin; local_data.script_dir = - g_strconcat(app->configdir, USER_SCRIPT_FOLDER, NULL); + g_strconcat(geany->app->configdir, USER_SCRIPT_FOLDER, NULL); if (!g_file_test(local_data.script_dir, G_FILE_TEST_IS_DIR)) { gchar *datadir = get_data_dir(); @@ -424,30 +423,30 @@ void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin g_build_path(G_DIR_SEPARATOR_S, datadir, "geany-plugins", "geanylua", NULL); g_free(datadir); } - if (app->debug_mode) { + if (geany->app->debug_mode) { g_printerr(_(" ==>> %s: Building menu from '%s'\n"), PLUGIN_NAME, local_data.script_dir); } local_data.on_saved_script = - g_strconcat(app->configdir, ON_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_SAVED_SCRIPT, NULL); local_data.on_opened_script = - g_strconcat(app->configdir, ON_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_OPENED_SCRIPT, NULL); local_data.on_created_script = - g_strconcat(app->configdir, ON_CREATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CREATED_SCRIPT, NULL); local_data.on_activated_script = - g_strconcat(app->configdir, ON_ACTIVATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_ACTIVATED_SCRIPT, NULL); local_data.on_init_script = - g_strconcat(app->configdir, ON_INIT_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_INIT_SCRIPT, NULL); local_data.on_cleanup_script = - g_strconcat(app->configdir, ON_CLEANUP_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CLEANUP_SCRIPT, NULL); local_data.on_configure_script = - g_strconcat(app->configdir, ON_CONFIGURE_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CONFIGURE_SCRIPT, NULL); local_data.on_proj_opened_script = - g_strconcat(app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); local_data.on_proj_saved_script = - g_strconcat(app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); local_data.on_proj_closed_script = - g_strconcat(app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL); glspi_set_sci_cmd_hash(TRUE); glspi_set_key_cmd_hash(TRUE); Modified: geanylua/glspi_sci.c 8 lines changed, 5 insertions(+), 3 deletions(-) =================================================================== @@ -758,6 +758,7 @@ static gint glspi_find(lua_State* L) gint flags=0; gint i,n; + gchar *text; DOC_REQUIRED switch (lua_gettop(L)) { case 0:return FAIL_STRING_ARG(1); @@ -771,7 +772,8 @@ static gint glspi_find(lua_State* L) if (!lua_isnumber(L,3)) { return FAIL_NUMERIC_ARG(3); } if (!lua_istable(L,4)) { return FAIL_TABLE_ARG(4); } - ttf.lpstrText=g_strdup(lua_tostring(L,1)); + text=g_strdup(lua_tostring(L,1)); + ttf.lpstrText=text; ttf.chrg.cpMin=lua_tonumber(L,2); ttf.chrg.cpMax=lua_tonumber(L,3); @@ -805,10 +807,10 @@ static gint glspi_find(lua_State* L) if (scintilla_send_message(doc->editor->sci,SCI_FINDTEXT,flags,(sptr_t)&ttf)!=-1) { push_number(L,ttf.chrgText.cpMin); push_number(L,ttf.chrgText.cpMax); - g_free(ttf.lpstrText); + g_free(text); return 2; } else { - g_free(ttf.lpstrText); + g_free(text); return 0; } } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] a9fdf3: GeanyPy: Fix use of `config.h` and `HAVE_CONFIG_H`
by Matthew Brush
04 Sep '14
04 Sep '14
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Matthew Brush <matt(a)geany.org> Date: Tue, 20 May 2014 06:25:19 UTC Commit: a9fdf323ceadadb3acfb3c1af209dce1a43d320e
https://github.com/geany/geany-plugins/commit/a9fdf323ceadadb3acfb3c1af209d…
Log Message: ----------- GeanyPy: Fix use of `config.h` and `HAVE_CONFIG_H` Modified Paths: -------------- geanypy/src/Makefile.am geanypy/src/geanypy-app.c geanypy/src/geanypy-dialogs.c geanypy/src/geanypy-document.c geanypy/src/geanypy-editor.c geanypy/src/geanypy-encoding.c geanypy/src/geanypy-filetypes.c geanypy/src/geanypy-highlighting.c geanypy/src/geanypy-indentprefs.c geanypy/src/geanypy-interfaceprefs.c geanypy/src/geanypy-main.c geanypy/src/geanypy-mainwidgets.c geanypy/src/geanypy-msgwindow.c geanypy/src/geanypy-navqueue.c geanypy/src/geanypy-plugin.c geanypy/src/geanypy-prefs.c geanypy/src/geanypy-project.c geanypy/src/geanypy-scinotification.c geanypy/src/geanypy-scinotifyheader.c geanypy/src/geanypy-scintilla.c geanypy/src/geanypy-search.c geanypy/src/geanypy-signalmanager.c geanypy/src/geanypy-templates.c geanypy/src/geanypy-uiutils.c geanypy/src/geanypy.h Modified: geanypy/src/Makefile.am 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -6,8 +6,7 @@ geanyplugindir = $(libdir)/geany geanypy_la_LDFLAGS = -module -avoid-version -Wl,--export-dynamic geanypy_la_CPPFLAGS = @GEANY_CFLAGS@ @PYGTK_CFLAGS@ @PYTHON_CPPFLAGS@ \ -DGEANYPY_PYTHON_DIR="\"$(libdir)/geany/geanypy\"" \ - -DGEANYPY_PLUGIN_DIR="\"$(datadir)/geany/geanypy/plugins\"" \ - -UHAVE_CONFIG_H + -DGEANYPY_PLUGIN_DIR="\"$(datadir)/geany/geanypy/plugins\"" geanypy_la_CFLAGS = @GEANYPY_CFLAGS@ @GMODULE_CFLAGS@ geanypy_la_LIBADD = @GEANY_LIBS@ @PYGTK_LIBS@ @PYTHON_LDFLAGS@ \ @PYTHON_EXTRA_LIBS@ @PYTHON_EXTRA_LDFLAGS@ \ Modified: geanypy/src/geanypy-app.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-dialogs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-document.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-editor.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-encoding.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-filetypes.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-highlighting.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-indentprefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-interfaceprefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-main.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-mainwidgets.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-msgwindow.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-navqueue.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-plugin.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,10 @@ * MA 02110-1301, USA. */ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #define INCLUDE_PYGOBJECT_ONCE_FULL #include "geanypy.h" Modified: geanypy/src/geanypy-prefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-project.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scinotification.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scinotifyheader.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scintilla.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-search.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-signalmanager.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" struct _SignalManager Modified: geanypy/src/geanypy-templates.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" /* TODO: see if the TemplatePrefs members are safe to modify. */ Modified: geanypy/src/geanypy-uiutils.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy.h 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -106,10 +106,6 @@ extern "C" { # define G_LOG_DOMAIN "GeanyPy" #endif -#ifndef GEANYPY_WINDOWS -# include "config.h" -#endif - #include "geanypy-document.h" #include "geanypy-editor.h" #include "geanypy-encoding.h" -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] b51849: Merge pull request #150 from codebrainz/geanypy-configh
by Frank Lanitz
04 Sep '14
04 Sep '14
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Wed, 03 Sep 2014 22:43:55 UTC Commit: b518495cab1037a878b5d450d053f9769dc3e0fe
https://github.com/geany/geany-plugins/commit/b518495cab1037a878b5d450d053f…
Log Message: ----------- Merge pull request #150 from codebrainz/geanypy-configh GeanyPy: Fix use of `config.h` and `HAVE_CONFIG_H` Modified Paths: -------------- geanypy/src/Makefile.am geanypy/src/geanypy-app.c geanypy/src/geanypy-dialogs.c geanypy/src/geanypy-document.c geanypy/src/geanypy-editor.c geanypy/src/geanypy-encoding.c geanypy/src/geanypy-filetypes.c geanypy/src/geanypy-highlighting.c geanypy/src/geanypy-indentprefs.c geanypy/src/geanypy-interfaceprefs.c geanypy/src/geanypy-main.c geanypy/src/geanypy-mainwidgets.c geanypy/src/geanypy-msgwindow.c geanypy/src/geanypy-navqueue.c geanypy/src/geanypy-plugin.c geanypy/src/geanypy-prefs.c geanypy/src/geanypy-project.c geanypy/src/geanypy-scinotification.c geanypy/src/geanypy-scinotifyheader.c geanypy/src/geanypy-scintilla.c geanypy/src/geanypy-search.c geanypy/src/geanypy-signalmanager.c geanypy/src/geanypy-templates.c geanypy/src/geanypy-uiutils.c geanypy/src/geanypy.h Modified: geanypy/src/Makefile.am 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -6,8 +6,7 @@ geanyplugindir = $(libdir)/geany geanypy_la_LDFLAGS = -module -avoid-version -Wl,--export-dynamic geanypy_la_CPPFLAGS = @GEANY_CFLAGS@ @PYGTK_CFLAGS@ @PYTHON_CPPFLAGS@ \ -DGEANYPY_PYTHON_DIR="\"$(libdir)/geany/geanypy\"" \ - -DGEANYPY_PLUGIN_DIR="\"$(datadir)/geany/geanypy/plugins\"" \ - -UHAVE_CONFIG_H + -DGEANYPY_PLUGIN_DIR="\"$(datadir)/geany/geanypy/plugins\"" geanypy_la_CFLAGS = @GEANYPY_CFLAGS@ @GMODULE_CFLAGS@ geanypy_la_LIBADD = @GEANY_LIBS@ @PYGTK_LIBS@ @PYTHON_LDFLAGS@ \ @PYTHON_EXTRA_LIBS@ @PYTHON_EXTRA_LDFLAGS@ \ Modified: geanypy/src/geanypy-app.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-dialogs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-document.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-editor.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-encoding.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-filetypes.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-highlighting.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-indentprefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-interfaceprefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-main.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-mainwidgets.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-msgwindow.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-navqueue.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-plugin.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,10 @@ * MA 02110-1301, USA. */ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #define INCLUDE_PYGOBJECT_ONCE_FULL #include "geanypy.h" Modified: geanypy/src/geanypy-prefs.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-project.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scinotification.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scinotifyheader.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-scintilla.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-search.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy-signalmanager.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" struct _SignalManager Modified: geanypy/src/geanypy-templates.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" /* TODO: see if the TemplatePrefs members are safe to modify. */ Modified: geanypy/src/geanypy-uiutils.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,7 @@ +#if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS) +# include "config.h" +#endif + #include "geanypy.h" Modified: geanypy/src/geanypy.h 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -106,10 +106,6 @@ extern "C" { # define G_LOG_DOMAIN "GeanyPy" #endif -#ifndef GEANYPY_WINDOWS -# include "config.h" -#endif - #include "geanypy-document.h" #include "geanypy-editor.h" #include "geanypy-encoding.h" -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
3
4
Older →
Jump to page:
1
2
3
4
Results per page:
10
25
50
100
200