Revision: 5268 http://geany.svn.sourceforge.net/geany/?rev=5268&view=rev Author: ntrel Date: 2010-10-01 12:43:32 +0000 (Fri, 01 Oct 2010)
Log Message: ----------- Fix passing quoted arguments when using 'Send Selection to'. This means sed 's/./(dot)/g' now works.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/geany.html trunk/doc/geany.txt trunk/src/tools.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-09-30 17:10:50 UTC (rev 5267) +++ trunk/ChangeLog 2010-10-01 12:43:32 UTC (rev 5268) @@ -1,3 +1,10 @@ +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,
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2010-09-30 17:10:50 UTC (rev 5267) +++ trunk/doc/geany.html 2010-10-01 12:43:32 UTC (rev 5268) @@ -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 @@ <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 @@ <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 "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.</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->Format->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->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 @@ <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>
Modified: trunk/doc/geany.txt =================================================================== --- trunk/doc/geany.txt 2010-09-30 17:10:50 UTC (rev 5267) +++ trunk/doc/geany.txt 2010-10-01 12:43:32 UTC (rev 5268) @@ -851,24 +851,32 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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. +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.
-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. +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 ^^^^^^^^^^^^^^^
Modified: trunk/src/tools.c =================================================================== --- trunk/src/tools.c 2010-09-30 17:10:50 UTC (rev 5267) +++ trunk/src/tools.c 2010-10-01 12:43:32 UTC (rev 5268) @@ -242,7 +242,12 @@ 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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.