There is some problem with Geany's context action command that is revealed by the following example.
Let's make a simple /home/me/sh1 executable file containing:
1 #! /bin/bash
2 echo "$1" "$2" "$3"
3 read
and set the context action command as:
xterm -e /home/me/sh1 $2 $3 "%s"
Now not going too far, let's select line #2 of our sh1 and run the context action command.
We'll get in xterm:
$2 $3 echo $1 $2 $3
while indeed we waited the following:
$2 $3 echo "$1" "$2" "$3"
To get it we should select the text with quotes escaped:
echo \"$1\" \"$2\" \"$3\"
Reason of all this mess is that Geany doesn't escape quotes in itself.
The internal Geany code swallows quotes of %s.
Moreover, if we select "$ in our text then we'll get nothing.
By this we'll totally confuse Geany.
Any odd number of " in selected text will do the same.
By the way, to process this sentence with context command we should write it as:
Any odd number of \" in selected text will do the same.
but writing and selecting it quoted:
"Any odd number of \" in selected text will do the same."
we'll get
$2 $3 Any
(after internal stripping all non-escaped quotes $3 parameter of sh1 will get "Any", $4 "odd", $5 "number" ...).
All this is not so good.
Geany should not modify any selected text any way.
It's for us stupid users to use any number of quotes and other stuff in processed text.
2nd issue is in "Compile/ Build/ Run settings".
If we set the Run command (let it be so dull, heh):
xterm -e /home/me/sh1 $2 $3 "%s"
and press F5, all we get in xterm is:
%s
Geany swallows all $ when they are followed by a number or a letter.
It takes them internally for some parameters and substitutes them in Run command with spaces.
Quoting them as in
xterm -e /home/me/sh1 "$2" "$3" "%s"
doesn't help as well.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.