Branch: refs/heads/master Author: Nick Treleaven nick.treleaven@btinternet.com Committer: Nick Treleaven nick.treleaven@btinternet.com Date: Wed, 12 Dec 2012 14:02:50 UTC Commit: 6ca889c78b0c1e089a35e0100b5232b0e6760a76 https://github.com/geany/geany/commit/6ca889c78b0c1e089a35e0100b5232b0e6760a...
Log Message: ----------- Add Document->Clone keybinding
Modified Paths: -------------- doc/geany.txt src/document.c src/document.h src/keybindings.c src/keybindings.h
Modified: doc/geany.txt 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -3627,6 +3627,8 @@ Document keybindings ==================================== ==================== ================================================== Action Default shortcut Description ==================================== ==================== ================================================== +Clone See `Cloning documents`_. + Replace tabs by space Replaces all tabs with the right amount of spaces.
Replace spaces by tabs Replaces leading spaces with tab characters.
Modified: src/document.c 15 files changed, 11 insertions(+), 4 deletions(-) =================================================================== @@ -2745,14 +2745,20 @@ GeanyDocument *document_index(gint idx) /* create a new file and copy file content and properties */ G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) { + GeanyDocument *old_doc = document_get_current(); + + if (old_doc) + document_clone(old_doc); +} + + +GeanyDocument *document_clone(GeanyDocument *old_doc) +{ gchar *text; GeanyDocument *doc; - GeanyDocument *old_doc = document_get_current(); ScintillaObject *old_sci;
- if (!old_doc) - return; - + g_return_val_if_fail(old_doc, NULL); old_sci = old_doc->editor->sci; if (sci_has_selection(old_sci)) text = sci_get_selection_contents(old_sci); @@ -2777,6 +2783,7 @@ G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_dat
/* update ui */ ui_document_show_hide(doc); + return doc; }
Modified: src/document.h 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -279,6 +279,8 @@ void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gcha
void document_grab_focus(GeanyDocument *doc);
+GeanyDocument *document_clone(GeanyDocument *old_doc); + G_END_DECLS
#endif
Modified: src/keybindings.c 5 files changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -561,6 +561,8 @@ static void init_default_kb(void) 0, 0, "menu_linewrap", _("Toggle Line wrapping"), "menu_line_wrapping1"); add_kb(group, GEANY_KEYS_DOCUMENT_LINEBREAK, NULL, 0, 0, "menu_linebreak", _("Toggle Line breaking"), "line_breaking1"); + add_kb(group, GEANY_KEYS_DOCUMENT_CLONE, NULL, + 0, 0, "menu_clone", _("_Clone"), "clone1"); add_kb(group, GEANY_KEYS_DOCUMENT_REPLACETABS, NULL, 0, 0, "menu_replacetabs", _("Replace tabs by space"), "menu_replace_tabs"); add_kb(group, GEANY_KEYS_DOCUMENT_REPLACESPACES, NULL, @@ -2348,6 +2350,9 @@ static gboolean cb_func_document_action(guint key_id) on_line_wrapping1_toggled(NULL, NULL); ui_document_show_hide(doc); break; + case GEANY_KEYS_DOCUMENT_CLONE: + document_clone(doc); + break; case GEANY_KEYS_DOCUMENT_RELOADTAGLIST: document_update_tags(doc); break;
Modified: src/keybindings.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -246,6 +246,7 @@ enum GeanyKeyBindingID GEANY_KEYS_PROJECT_CLOSE, /**< Keybinding. */ GEANY_KEYS_FORMAT_JOINLINES, /**< Keybinding. */ GEANY_KEYS_GOTO_LINESTARTVISUAL, /**< Keybinding. */ + GEANY_KEYS_DOCUMENT_CLONE, /**< Keybinding. */ GEANY_KEYS_COUNT /* must not be used by plugins */ };
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).