[R-SIG-Mac] RGUI 1.19: closing help window problem; Auto-Pair, auto-completion suggestions
Simon Urbanek
simon.urbanek at r-project.org
Wed May 9 22:44:51 CEST 2007
On Apr 27, 2007, at 4:01 AM, Hans-Joerg Bibiko wrote:
> I just installed RGUI 1.19. It is really well done! Thanks a lot!
>
> I have three tiny things:
>
> 1) If I type e.g. '?mean' the help window appears. Fine. I type APPLE
> +W to close it (or with the mouse). It closes.
> But: If I want to type my next command, I cannot because the focus is
> not set to the R.app console. (Maybe this could be implemented?)
> OK. I press APPLE+` to select the R.app console BUT now the help
> window appears again!
> If I use the mouse clicking into the console it works well. But I'm
> usually a keyboard user.
>
> I'm using R 2.5.0 (2007-04-23) GUI 1.19 (4308) on Mac G5 10.4.9 PPC
>
There is a general problem involving closing windows. We can't find
the underlying problem (somewhere deep in Cocoa's document management
infrastructure), so we have a few hacks in place, but they only
curing the symptoms and not all possible variations. The GUI 2.0 will
hopefully provide a solution ...
> 2) Auto-Pair: I mean if I type 'matrix(' RGUI adds the closing
> parathesis automatically. This is very helpful. It also works for
> '[', '{'.
> My suggestion is to add this functionality also to ' and ". It is
> often the case that I forget a closing ' in commands like source
> ('file, chdir=T).
>
It is not as easy. With brackets they have distinct beginning and
ending symbol: "(" vs ")". For strings there is no such thing as "'"
can be both the beginning and the end. Therefore it is hard to deicde
whether your typed "'" is a) beginning of a string, b) just a random
apostrophe (like in "don't") c) end of a string. Therefore the
defensive view is to not try to read user's mind (which usually
doesn't work ;)).
> 3) Auto-Completion
> This is also very helpful! But there are some tiny things to mention:
> If I type 'matri' and I press TAB or CTRL+. it suggests 'matrix('.
> Fine, but if I press ENTER it inserts a new line as well. OK I can
> use ARROWRIGHT, but I think pressing ENTER is more common.
We are use Cocoa's default facilities here and there are not
configurable (AFAIK). We used to have custom completion some time
ago, but then we didn't have the list of options. I guess the real
way forward is to stop using Cocoa's default and write an own
implementation including the list of choices ... I didn't have time
to do that yet, but if someone volunteers, it would be great, because
I agree that the status-quo is not perfect.
> The next is that if I press ARROWRIGHT it inserts 'matrix(' not
> 'matrix(|)' [| indicates the cursor]. I believe this would be more
> straightforward to do so.
>
Unfortunately not the way it works now - the auto-closing is
triggered by typing "(", but in the case of auto-completion the "("
is not typed but inserted by the system, so we need to work around
that ... Again, if we had custom auto-completion we'd have more
control over this ...
> A future topic could be to implement a context specific auto-
> completion of parameters for a given command Example: I type 'matrix
> (data, by' and press TAB to auto-complete 'by' to 'byrow='
> [Maybe 'byrow=' plus a pull-down menu with TRUE, FALSE if the
> parameter is boolean ;) ]
>
True, good idea. Currently the syntax-completion is context-
independent, so it doesn't know that it is in a function call. But
that could be implemented ...
> Furthermore a pull-down menu of all available parameters used in a
> function would be great.
>
That is equal to typing foo( and pressing tab twice if we have the
above.
Cheers,
Simon
More information about the R-SIG-Mac
mailing list