Kaydet (Commit) dc61e14c authored tarafından Nick Treleaven's avatar Nick Treleaven

Fix passing quoted arguments when using 'Send Selection to'. This

means sed 's/\./(dot)/g' now works.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5268 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 050bec1b
2010-10-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/tools.c, doc/geany.txt, doc/geany.html:
Fix passing quoted arguments when using 'Send Selection to'. This
means sed 's/\./(dot)/g' now works.
2010-09-30 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/utils.h, src/filetypesprivate.h, src/filetypes.c,
......
......@@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2010-09-23" />
<meta name="date" content="2010-09-30" />
<style type="text/css">
/*
......@@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2010-09-23</td></tr>
<td>2010-09-30</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.20</td></tr>
</tbody>
......@@ -1259,21 +1259,27 @@ and between different files.</p>
<div class="section">
<h3><a class="toc-backref" href="#id49" id="sending-text-through-custom-commands" name="sending-text-through-custom-commands">Sending text through custom commands</a></h3>
<p>You can define several custom commands in Geany and send the current
selection to one of these commands using the &quot;Edit-&gt;Format-&gt;Send
Selection to&quot; menu or keybindings.
The output of the command will be
used to replace the current selection. This makes it possible to use text
formatting tools with Geany in a general way. The selected text will
be sent to the standard input of the executed command, so the command
should be able to read from it and it should print all results to its
standard output which will be read by Geany. To help finding errors
in executing the command, the output of the program's standard error
will be printed on Geany's standard output.</p>
<p>To add a custom command, just go to the Set Custom Commands dialog
in the Format sub menu of the Edit and Popup menu. Then click on Add
to get a new text entry and type the command. You can also specify
some command line options. To delete a command, just clear the text
entry and press OK. It will be deleted automatically.</p>
selection to one of these commands using the <em>Edit-&gt;Format-&gt;Send
Selection to</em> menu or keybindings. The output of the command will be
used to replace the current selection. This makes it possible to use
text formatting tools with Geany in a general way.</p>
<p>The selected text will be sent to the standard input of the executed
command, so the command should be able to read from it and it should
print all results to its standard output which will be read by
Geany. To help finding errors in executing the command, the output
of the program's standard error will be printed on Geany's standard
output.</p>
<p>To add a custom command, use the <em>Send Selection to-&gt;Set Custom
Commands</em> menu item. Click on <em>Add</em> to get a new text entry and type
the command. You can also specify some command line options. To
delete a command, just clear the text entry and press OK. It will be
deleted automatically.</p>
<p>Normal shell quoting is supported, so you can do things like:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">sed</span> <span class="pre">'s/\./(dot)/g'</span></tt></li>
</ul>
<p>The above example would normally be done with the <a class="reference" href="#replace-all">Replace all</a>
function, but it can be handy to have common commands already set up.</p>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id50" id="context-actions" name="context-actions">Context actions</a></h3>
......@@ -6207,7 +6213,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
Generated on: 2010-09-23 18:04 UTC.
Generated on: 2010-10-01 12:43 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
......
......@@ -851,22 +851,30 @@ Sending text through custom commands
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can define several custom commands in Geany and send the current
selection to one of these commands using the "Edit->Format->Send
Selection to" menu or keybindings.
The output of the command will be
used to replace the current selection. This makes it possible to use text
formatting tools with Geany in a general way. The selected text will
be sent to the standard input of the executed command, so the command
should be able to read from it and it should print all results to its
standard output which will be read by Geany. To help finding errors
in executing the command, the output of the program's standard error
will be printed on Geany's standard output.
To add a custom command, just go to the Set Custom Commands dialog
in the Format sub menu of the Edit and Popup menu. Then click on Add
to get a new text entry and type the command. You can also specify
some command line options. To delete a command, just clear the text
entry and press OK. It will be deleted automatically.
selection to one of these commands using the *Edit->Format->Send
Selection to* menu or keybindings. The output of the command will be
used to replace the current selection. This makes it possible to use
text formatting tools with Geany in a general way.
The selected text will be sent to the standard input of the executed
command, so the command should be able to read from it and it should
print all results to its standard output which will be read by
Geany. To help finding errors in executing the command, the output
of the program's standard error will be printed on Geany's standard
output.
To add a custom command, use the *Send Selection to->Set Custom
Commands* menu item. Click on *Add* to get a new text entry and type
the command. You can also specify some command line options. To
delete a command, just clear the text entry and press OK. It will be
deleted automatically.
Normal shell quoting is supported, so you can do things like:
* ``sed 's/\./(dot)/g'``
The above example would normally be done with the `Replace all`_
function, but it can be handy to have common commands already set up.
Context actions
......
......@@ -242,7 +242,12 @@ void tools_execute_custom_command(GeanyDocument *doc, const gchar *command)
if (! sci_has_selection(doc->editor->sci))
return;
argv = g_strsplit(command, " ", -1);
if (!g_shell_parse_argv(command, NULL, &argv, &error))
{
ui_set_statusbar(TRUE, _("Custom command failed: %s"), error->message);
g_error_free(error);
return;
}
ui_set_statusbar(TRUE, _("Passing data and executing custom command: %s"), command);
cc_error_occurred = FALSE;
......
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