Kaydet (Commit) 59079283 authored tarafından Enrico Tröger's avatar Enrico Tröger

Add 'Send Selection to Terminal' command to the Edit->Format menu (initial patch…

Add 'Send Selection to Terminal' command to the Edit->Format menu (initial patch by David Gleich, thanks).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3601 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst f40a88fc
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
* src/templates.c: * src/templates.c:
Fix wrong Fortran 90 comment characters when inserting templates. Fix wrong Fortran 90 comment characters when inserting templates.
* doc/geany.html, doc/geany.txt, geany.glade, src/callbacks.c,
src/callbacks.h, src/editor.c, src/interface.c, src/keybindings.c,
src/keybindings.h, src/main.c, src/plugindata.h, src/vte.c,
src/vte.h, THANKS:
Add 'Send Selection to Terminal' command to the Edit->Format menu
(initial patch by David Gleich, thanks).
2009-02-24 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2009-02-24 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
......
...@@ -60,6 +60,7 @@ Guillaume de Rorthais <ioguix(at)free(dot)fr> - Auto-close brackets/braces/quote ...@@ -60,6 +60,7 @@ Guillaume de Rorthais <ioguix(at)free(dot)fr> - Auto-close brackets/braces/quote
Tyler Mulligan <tyler(at)doknowevil(dot)net> - Close All toolbar icon Tyler Mulligan <tyler(at)doknowevil(dot)net> - Close All toolbar icon
Philipp Gildein <philipp(at)gildein(dot)com> - Ada filetype patch Philipp Gildein <philipp(at)gildein(dot)com> - Ada filetype patch
Thomas Martitz <thomas47(at)arcor(dot)de> - Multiple %cursor% wildcards in Snippets patch Thomas Martitz <thomas47(at)arcor(dot)de> - Multiple %cursor% wildcards in Snippets patch
David Gleich <dgleich(at)stanford(dot)edu> - Send Selection to Terminal patch
Translators: Translators:
------------ ------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Geany</title> <title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2009-02-15" /> <meta name="date" content="$Date$" />
<style type="text/css"> <style type="text/css">
/* /*
...@@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele. ...@@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
<br />Nick Treleaven <br />Nick Treleaven
<br />Frank Lanitz</td></tr> <br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th> <tr><th class="docinfo-name">Date:</th>
<td>2009-02-15</td></tr> <td>$Date$</td></tr>
<tr><th class="docinfo-name">Version:</th> <tr><th class="docinfo-name">Version:</th>
<td>0.17</td></tr> <td>0.17</td></tr>
</tbody> </tbody>
...@@ -2819,6 +2819,20 @@ space.</td> ...@@ -2819,6 +2819,20 @@ space.</td>
<td>Indents the current line or all selected lines <td>Indents the current line or all selected lines
with the same indentation as the previous line.</td> with the same indentation as the previous line.</td>
</tr> </tr>
<tr><td>Send to Custom Command 1 (2,3)</td>
<td>Ctrl-1 (2,3)</td>
<td>Passes the current selection to a configured
external command (available for the first
three configured commands, see
<a class="reference internal" href="#send-text-through-definable-commands">Send text through definable commands</a> for
details).</td>
</tr>
<tr><td>Send Selection to Verminal</td>
<td>&nbsp;</td>
<td>Sends the current selection or the current
line (if there is no selection) to the
embedded Terminal (VTE).</td>
</tr>
<tr><td><strong>Settings</strong></td> <tr><td><strong>Settings</strong></td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>&nbsp;</td>
...@@ -4691,7 +4705,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p> ...@@ -4691,7 +4705,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer"> <div class="footer">
<hr class="footer" /> <hr class="footer" />
<a class="reference external" href="geany.txt">View document source</a>. <a class="reference external" href="geany.txt">View document source</a>.
Generated on: 2009-02-15 14:07 UTC. Generated on: 2009-02-25 23:11 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div> </div>
......
...@@ -2553,6 +2553,17 @@ Decrease indent by one space Deindents the current ...@@ -2553,6 +2553,17 @@ Decrease indent by one space Deindents the current
Smart line indent Indents the current line or all selected lines Smart line indent Indents the current line or all selected lines
with the same indentation as the previous line. with the same indentation as the previous line.
Send to Custom Command 1 (2,3) Ctrl-1 (2,3) Passes the current selection to a configured
external command (available for the first
three configured commands, see
`Send text through definable commands`_ for
details).
Send Selection to Verminal Sends the current selection or the current
line (if there is no selection) to the
embedded Terminal (VTE).
**Settings** **Settings**
Preferences Ctrl-Alt-P Opens preferences dialog. Preferences Ctrl-Alt-P Opens preferences dialog.
......
This diff is collapsed.
...@@ -2219,3 +2219,14 @@ on_debug_messages1_activate (GtkMenuItem *menuitem, ...@@ -2219,3 +2219,14 @@ on_debug_messages1_activate (GtkMenuItem *menuitem,
log_show_debug_messages_dialog(); log_show_debug_messages_dialog();
} }
void
on_send_selection_to_vte1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
#ifdef HAVE_VTE
if (vte_info.load_vte)
vte_send_selection_to_vte();
#endif
}
...@@ -598,3 +598,7 @@ void ...@@ -598,3 +598,7 @@ void
on_menu_show_indentation_guides1_toggled on_menu_show_indentation_guides1_toggled
(GtkCheckMenuItem *checkmenuitem, (GtkCheckMenuItem *checkmenuitem,
gpointer user_data); gpointer user_data);
void
on_send_selection_to_vte1_activate (GtkMenuItem *menuitem,
gpointer user_data);
...@@ -4459,4 +4459,3 @@ void editor_apply_update_prefs(GeanyEditor *editor) ...@@ -4459,4 +4459,3 @@ void editor_apply_update_prefs(GeanyEditor *editor)
editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP); editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP);
sci_assign_cmdkey(sci, SCK_END, SCI_LINEENDWRAP); sci_assign_cmdkey(sci, SCK_END, SCI_LINEENDWRAP);
} }
This diff is collapsed.
...@@ -312,6 +312,8 @@ static void init_default_kb(void) ...@@ -312,6 +312,8 @@ static void init_default_kb(void)
GDK_2, GDK_CONTROL_MASK, "edit_sendtocmd2", _("Send to Custom Command 2"), NULL); GDK_2, GDK_CONTROL_MASK, "edit_sendtocmd2", _("Send to Custom Command 2"), NULL);
keybindings_set_item(group, GEANY_KEYS_FORMAT_SENDTOCMD3, cb_func_format_action, keybindings_set_item(group, GEANY_KEYS_FORMAT_SENDTOCMD3, cb_func_format_action,
GDK_3, GDK_CONTROL_MASK, "edit_sendtocmd3", _("Send to Custom Command 3"), NULL); GDK_3, GDK_CONTROL_MASK, "edit_sendtocmd3", _("Send to Custom Command 3"), NULL);
keybindings_set_item(group, GEANY_KEYS_FORMAT_SENDTOVTE, cb_func_format_action,
0, 0, "edit_sendtovte", _("Send Selection to Terminal"), LW(send_selection_to_vte1));
group = ADD_KB_GROUP(INSERT, _("Insert")); group = ADD_KB_GROUP(INSERT, _("Insert"));
...@@ -676,6 +678,7 @@ static void add_popup_menu_accels(void) ...@@ -676,6 +678,7 @@ static void add_popup_menu_accels(void)
GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_COMMENTLINETOGGLE, menu_toggle_line_commentation2); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_COMMENTLINETOGGLE, menu_toggle_line_commentation2);
GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_INCREASEINDENT, menu_increase_indent2); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_INCREASEINDENT, menu_increase_indent2);
GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_DECREASEINDENT, menu_decrease_indent2); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_DECREASEINDENT, menu_decrease_indent2);
GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_SENDTOVTE, send_selection_to_vte2);
/* the build menu items are set if the build menus are created */ /* the build menu items are set if the build menus are created */
...@@ -1910,6 +1913,9 @@ static void cb_func_format_action(guint key_id) ...@@ -1910,6 +1913,9 @@ static void cb_func_format_action(guint key_id)
if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2) if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2)
tools_execute_custom_command(doc, ui_prefs.custom_commands[2]); tools_execute_custom_command(doc, ui_prefs.custom_commands[2]);
break; break;
case GEANY_KEYS_FORMAT_SENDTOVTE:
on_send_selection_to_vte1_activate(NULL, NULL);
break;
} }
} }
......
...@@ -180,6 +180,7 @@ enum ...@@ -180,6 +180,7 @@ enum
GEANY_KEYS_FORMAT_SENDTOCMD1, GEANY_KEYS_FORMAT_SENDTOCMD1,
GEANY_KEYS_FORMAT_SENDTOCMD2, GEANY_KEYS_FORMAT_SENDTOCMD2,
GEANY_KEYS_FORMAT_SENDTOCMD3, GEANY_KEYS_FORMAT_SENDTOCMD3,
GEANY_KEYS_FORMAT_SENDTOVTE,
GEANY_KEYS_FORMAT_COUNT GEANY_KEYS_FORMAT_COUNT
}; };
......
...@@ -236,6 +236,17 @@ static void apply_settings(void) ...@@ -236,6 +236,17 @@ static void apply_settings(void)
/* whether to show notebook tabs or not */ /* whether to show notebook tabs or not */
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
#ifdef HAVE_VTE
if (! vte_info.load_vte)
{
gtk_widget_hide(ui_lookup_widget(main_widgets.window, "send_selection_to_vte1"));
gtk_widget_hide(ui_lookup_widget(main_widgets.editor_menu, "send_selection_to_vte2"));
}
#else
gtk_widget_hide(ui_lookup_widget(main_widgets.window, "send_selection_to_vte1"));
gtk_widget_hide(ui_lookup_widget(main_widgets.editor_menu, "send_selection_to_vte2"));
#endif
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
enum { enum {
/** The Application Programming Interface (API) version, incremented /** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */ * whenever any plugin data types are modified or appended to. */
GEANY_API_VERSION = 132, GEANY_API_VERSION = 133,
/** The Application Binary Interface (ABI) version, incremented whenever /** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */ * existing fields in the plugin data types have to be changed or reordered. */
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include "msgwindow.h" #include "msgwindow.h"
#include "callbacks.h" #include "callbacks.h"
#include "geanywraplabel.h" #include "geanywraplabel.h"
#include "editor.h"
#include "sciwrappers.h"
VteInfo vte_info; VteInfo vte_info;
...@@ -897,4 +899,41 @@ void vte_append_preferences_tab(void) ...@@ -897,4 +899,41 @@ void vte_append_preferences_tab(void)
} }
void vte_send_selection_to_vte(void)
{
GeanyDocument *doc;
gchar *text;
gsize len;
doc = document_get_current();
if (doc == NULL)
return;
if (sci_has_selection(doc->editor->sci))
{
text = g_malloc0(sci_get_selected_text_length(doc->editor->sci) + 1);
sci_get_selected_text(doc->editor->sci, text);
}
else
{ /* Get the current line */
gint line_num = sci_get_current_line(doc->editor->sci);
text = sci_get_line(doc->editor->sci, line_num);
}
len = strlen(text);
/* Make sure there is no newline character at the end to prevent unwanted execution */
if (text[len-1] == '\n' || text[len-1] == '\r')
text[len-1] = '\0';
vf->vte_terminal_feed_child(VTE_TERMINAL(vc->vte), text, len);
/* show the VTE */
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_VTE);
gtk_widget_grab_focus(vc->vte);
msgwin_show_hide(TRUE);
g_free(text);
}
#endif #endif
...@@ -76,6 +76,7 @@ void vte_cwd(const gchar *filename, gboolean force); ...@@ -76,6 +76,7 @@ void vte_cwd(const gchar *filename, gboolean force);
void vte_append_preferences_tab(void); void vte_append_preferences_tab(void);
void vte_send_selection_to_vte(void);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment