Feature requests

4 views
Skip to first unread message

jmb

unread,
Jul 22, 2010, 3:27:09 AM7/22/10
to DreamPie
Hi,

I've been using Dreampie for two weeks now and I have a couple of
feature requests:

- Add an option to exchange the meaning of Return and Ctl-Return. The
reason is, there are relatively few times where I write a multi-line
command in the shell. However, what I do a lot more frequently is to
go back through the history, change the command slightly and re-run
it. However, by that time the cursor is usually somewhere in the
middle of the line so just hitting Return inserts a new line. Note
that the proposed behaviour would be more consistent with what happens
in other software. In Excel for example, hitting Return will validate
the contents of the current cell, whereas hitting Alt-Return inserts a
new line.

- Add an option to disable the "magic space" key. This is actually
somewhat related to the previous request: the fact that hitting space
after a function name automatically inserts the required parenthesis
means that the cursor is no longer at the end of the line when I hit
Return, so I get a new line instead of the command being run. I know
that I could just refrain from hitting space after function names, but
I'm used to inserting a space between the name and the opening
parenthesis and it has become completely automatic.

Thanks,

Jerome

Noam Yorav-Raphael

unread,
Jul 22, 2010, 6:29:11 PM7/22/10
to drea...@googlegroups.com
Hi,

On Thu, Jul 22, 2010 at 8:27 AM, jmb <berger...@gmail.com> wrote:
>
> Hi,
>
> I've been using Dreampie for two weeks now and I have a couple of
> feature requests:
>
> - Add an option to exchange the meaning of Return and Ctl-Return. The
> reason is, there are relatively few times where I write a multi-line
> command in the shell. However, what I do a lot more frequently is to
> go back through the history, change the command slightly and re-run
> it. However, by that time the cursor is usually somewhere in the
> middle of the line so just hitting Return inserts a new line. Note
> that the proposed behaviour would be more consistent with what happens
> in other software. In Excel for example, hitting Return will validate
> the contents of the current cell, whereas hitting Alt-Return inserts a
> new line.

I don't think I will do that. Technically it might be complicated, and
anyway, I'd like editor keys to keep their behaviour. In excel there
are no new lines, so I don't think it's a good example. In IDLE enters
many times run the command, but I don't like that - I like the command
to be executed only when it's ready. So I hope you'll get used to
pressing ctrl-enter.


>
> - Add an option to disable the "magic space" key. This is actually
> somewhat related to the previous request: the fact that hitting space
> after a function name automatically inserts the required parenthesis
> means that the cursor is no longer at the end of the line when I hit
> Return, so I get a new line instead of the command being run. I know
> that I could just refrain from hitting space after function names, but
> I'm used to inserting a space between the name and the opening
> parenthesis and it has become completely automatic.

I accept your point. I'll add an option to disable auto parentheses.
(I filed a bug to remind me, but it will take some time, as I'm on
vacation.)
>
Thanks for your feedback!
Noam

jmb

unread,
Jul 23, 2010, 4:38:40 AM7/23/10
to DreamPie
On Jul 23, 12:29 am, Noam Yorav-Raphael <noamr...@gmail.com> wrote:
> On Thu, Jul 22, 2010 at 8:27 AM, jmb <berger.jer...@gmail.com> wrote:
> > - Add an option to exchange the meaning of Return and Ctl-Return. The
> > reason is, there are relatively few times where I write a multi-line
> > command in the shell. However, what I do a lot more frequently is to
> > go back through the history, change the command slightly and re-run
> > it. However, by that time the cursor is usually somewhere in the
> > middle of the line so just hitting Return inserts a new line. Note
> > that the proposed behaviour would be more consistent with what happens
> > in other software. In Excel for example, hitting Return will validate
> > the contents of the current cell, whereas hitting Alt-Return inserts a
> > new line.
>
> I don't think I will do that. Technically it might be complicated, and
> anyway, I'd like editor keys to keep their behaviour. In excel there
> are no new lines, so I don't think it's a good example. In IDLE enters
> many times run the command, but I don't like that - I like the command
> to be executed only when it's ready. So I hope you'll get used to
> pressing ctrl-enter.
>
Actually, there are new lines in Excel. Try hitting Alt-Return in a
cell and it will create a new line instead of moving to the cell below
(should be true also in OO, koffice and gnumeric AFAIK). I've just
written a patch that switches them. It's just 5 lines of code (since I
didn't make it configurable) so it's not too difficult technically.
OTOH, I can live with my patched version if you don't do it.

>
> > - Add an option to disable the "magic space" key. This is actually
> > somewhat related to the previous request: the fact that hitting space
> > after a function name automatically inserts the required parenthesis
> > means that the cursor is no longer at the end of the line when I hit
> > Return, so I get a new line instead of the command being run. I know
> > that I could just refrain from hitting space after function names, but
> > I'm used to inserting a space between the name and the opening
> > parenthesis and it has become completely automatic.
>
> I accept your point. I'll add an option to disable auto parentheses.
> (I filed a bug to remind me, but it will take some time, as I'm on
> vacation.)
>
Great, thanks!

Jerome

jmb

unread,
Jul 23, 2010, 4:57:31 AM7/23/10
to DreamPie
On Jul 23, 10:38 am, jmb <berger.jer...@gmail.com> wrote:
> I've just
> written a patch that switches them. It's just 5 lines of code (since I
> didn't make it configurable) so it's not too difficult technically.
> OTOH, I can live with my patched version if you don't do it.
>
I'm not sure what's the best way to send a patch, but given that it's
very short, I'll just paste it here:

==============================8<------------------------------
diff -r b578d1e9d140 dreampielib/gui/__init__.py
--- a/dreampielib/gui/__init__.py Fri Jul 23 10:17:06 2010 +0200
+++ b/dreampielib/gui/__init__.py Fri Jul 23 10:34:37 2010 +0200
@@ -396,7 +396,11 @@

@sourceview_keyhandler('Return', 0)
def on_sourceview_return(self):
+ self.orig_on_execute_command (None)
+ return True
+
+ def orig_on_sourceview_return(self):
sb = self.sourcebuffer

# If we are on the first line, and it doesn't end with a ' ':
@@ -710,7 +714,10 @@
assert it2.ends_tag(stdin)

def on_execute_command(self, _widget):
+ self.orig_on_sourceview_return()
+
+ def orig_on_execute_command(self, _widget):
if self.is_executing:
self.send_stdin()
elif self.sourcebuffer.get_char_count() == 0:
------------------------------>8==============================

Jerome

Noam Yorav-Raphael

unread,
Jul 26, 2010, 3:39:29 AM7/26/10
to drea...@googlegroups.com
Thanks for the patch!

For now I'll leave it at this stage, unless there's greater demand for
this option. I try to be careful with configuration options that
change the basic way you work with a program; I think it's something
like Python's not having lines in the beginning of the file that
change the semantics of the language. If more people think it's
important, I'll reconsider it.

Thanks again,
Noam

Reply all
Reply to author
Forward
0 new messages