[Geany] Send selection&newline to terminal

Enrico Tröger enrico.troeger at xxxxx
Sun Nov 29 21:03:38 UTC 2009


On Sat, 28 Nov 2009 22:00:11 +0000, Liviu wrote:

>Hello Enrico
>
>On 11/28/09, Enrico Tröger <enrico.troeger at uvena.de> wrote:
>> On Sat, 28 Nov 2009 12:24:27 +0100, Enrico wrote:
>>  Geany actually removes the last trailing \n from the selection to
>>  explicitly try to prevent the requested behaviour and I still think
>>  this is good and should be kept.
>>
>I understand the reasons for keeping the conservative approach default
>(the "rm -rf ~" example). However it makes the feature virtually
>useless in more specific cases (such as evaluating R code). As is, to
>evaluate the second line of the following dummy R paragraph
>"2+2
>3+3
>4+4
>
>"
>
>I would need to:
>- select "3+3"
>- send selection to terminal
>- with the mouse focus the terminal
>- hit enter
>- with the mouse hit on the correct part of the document to return
>editing.
>
>To execute the last line is much easier:
>- select "4+4" and the following "" empty line
>- send selection to terminal.
>
>Here the code gets evaluated quickly and I can resume editing
>immediately. Being unable to easily execute R code is one of the main
>reasons I cannot use Geany for my R projects.

In SVN, you got a new hidden preference:

send_selection_unsafe

It defaults to false, the current behaviour. If set to true, it does
not strip trailing newline characters and even add one if not already
present. This should pretty much do what you requested :).
But be sure that this can be dangerous when you select some arbitary
text, by accident hit the keybinding to send the selection to the VTE
and it gets executed. If you boom away your system, you are on your
own, you can't blame Geany :).


Btw, while I was at it, I fixed a bug where you could actually select
some text followed by a multiple empty lines and so Geany executed it
because it only stripped the first trailing newline. Now, it strips
them all.



>> Which %s?
>>  Liviu is talking about "Send Selection to terminal" which doesn't
>> have a command setting where a %s can be specified. Instead, this
>> feature just sends the selection directly to the VTE.
>>
>Would it be possible to make the feature configurable? Keep a default,
>as is "Send Selection to terminal", but allow the user to configure an
>additional "Send selection" action with custom behaviour? In the
>context of R, actions such as "Send current line to terminal" or "Send
>current paragraph to terminal" (and the ability to assign bindings to
>them) would be great, but a possible "Send Selection & empty-line to
>terminal" would already be a boon.

I think this is too heavy for Geany itself, but could and should be
easily implemented as a plugin. You just need to do it or find someone
who is willing to do :).

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20091129/1c3462ad/attachment.pgp>


More information about the Users mailing list