[geany/geany] 9219e9: Make build_run_cmd support independent execute & add keybinding
Nick Treleaven
git-noreply at xxxxx
Sat Oct 5 11:31:09 UTC 2019
Branch: refs/heads/build-exec
Author: Nick Treleaven <n at trelsoft.com>
Committer: Nick Treleaven <n at trelsoft.com>
Date: Sat, 05 Oct 2019 11:31:09 UTC
Commit: 9219e983c181a78c7e3448a92702fcec9d5d5ad5
https://github.com/geany/geany/commit/9219e983c181a78c7e3448a92702fcec9d5d5ad5
Log Message:
-----------
Make build_run_cmd support independent execute & add keybinding
Modified Paths:
--------------
src/build.c
src/keybindings.c
src/keybindings.h
Modified: src/build.c
21 lines changed, 13 insertions(+), 8 deletions(-)
===================================================================
@@ -858,16 +858,13 @@ static void build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *d
* the command; otherwise the command itself is returned. working_dir is a pointer
* to the working directory from which the command is executed. Both strings are
* in the locale encoding. */
-static gchar *prepare_run_cmd(GeanyDocument *doc, gchar **working_dir, guint cmdindex)
+static gchar *prepare_run_cmd(GeanyDocument *doc, GeanyBuildCommand *cmd, gchar **working_dir)
{
- GeanyBuildCommand *cmd = NULL;
const gchar *cmd_working_dir;
gboolean autoclose = FALSE;
gchar *cmd_string_utf8, *working_dir_utf8, *run_cmd, *cmd_string;
GError *error = NULL;
- cmd = get_build_cmd(doc, GEANY_GBG_EXEC, cmdindex, NULL);
-
cmd_string_utf8 = build_replace_placeholder(doc, cmd->command);
cmd_working_dir = cmd->working_dir;
if (EMPTY(cmd_working_dir))
@@ -925,15 +922,18 @@ static gchar *prepare_run_cmd(GeanyDocument *doc, gchar **working_dir, guint cmd
}
-static void build_run_cmd(GeanyDocument *doc, guint cmdindex)
+static void build_run_cmd(GeanyDocument *doc, guint group, guint cmdindex)
{
gchar *working_dir;
gchar *run_cmd = NULL;
if (! DOC_VALID(doc) || doc->file_name == NULL)
return;
-
- run_cmd = prepare_run_cmd(doc, &working_dir, cmdindex);
+ GeanyBuildCommand *cmd = get_build_cmd(doc, group, cmdindex, NULL);
+ if (!cmd)
+ return;
+
+ run_cmd = prepare_run_cmd(doc, cmd, &working_dir);
if (run_cmd == NULL)
return;
@@ -1319,7 +1319,7 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data)
g_free(uri);
}
else
- build_run_cmd(doc, cmd);
+ build_run_cmd(doc, grp, cmd);
}
else
build_command(doc, grp, cmd, NULL);
@@ -2841,6 +2841,11 @@ gboolean build_keybinding(guint key_id)
case GEANY_KEYS_BUILD_RUN:
item = menu_items->menu_item[GEANY_GBG_EXEC][GBO_TO_CMD(GEANY_GBO_EXEC)];
break;
+ case GEANY_KEYS_BUILD_RUNINDEPENDENT:
+ {
+ build_run_cmd(doc, GEANY_GBG_EXEC_IND, 0);
+ return TRUE;
+ }
case GEANY_KEYS_BUILD_OPTIONS:
item = menu_items->menu_item[GBG_FIXED][GBF_COMMANDS];
break;
Modified: src/keybindings.c
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -704,6 +704,8 @@ static void init_default_kb(void)
0, 0, "build_previouserror", _("Previous error"), NULL);
add_kb(group, GEANY_KEYS_BUILD_RUN, NULL,
GDK_F5, 0, "build_run", _("Run"), NULL);
+ add_kb(group, GEANY_KEYS_BUILD_RUNINDEPENDENT, NULL,
+ GDK_F5, GDK_SHIFT_MASK, "build_run_ind", _("_Independent Run"), NULL);
add_kb(group, GEANY_KEYS_BUILD_OPTIONS, NULL,
0, 0, "build_options", _("Build options"), NULL);
Modified: src/keybindings.h
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -273,8 +273,9 @@ enum GeanyKeyBindingID
GEANY_KEYS_FORMAT_SENDTOCMD8, /**< Keybinding. */
GEANY_KEYS_FORMAT_SENDTOCMD9, /**< Keybinding. */
GEANY_KEYS_EDITOR_DELETELINETOBEGINNING, /**< Keybinding. */
- GEANY_KEYS_DOCUMENT_STRIPTRAILINGSPACES, /**< Keybinding.
- * @since 1.34 (API 238) */
+ GEANY_KEYS_DOCUMENT_STRIPTRAILINGSPACES, /**< Keybinding. */
+ GEANY_KEYS_BUILD_RUNINDEPENDENT, /**< Keybinding.
+ * @since 1.34 (API 239) */
GEANY_KEYS_COUNT /* must not be used by plugins */
};
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list