[RkWard-devel] Playing with R console

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Sep 28 16:50:26 UTC 2004


Hi Pierre!

> I've been playing a bit with the R-console. Nothing
> much, I'm just getting acquainted with the code, and
> seeing if I understand it: I know C++, but not qt/kde.
> I propose a new layout of the window. The code is
> edited above, and results are below. Furthermore,
> clicking "run" no longer empties the text area. I
> added a "run selection" button. Just ignore the patch
> if you don't like this layout.

Interesting different concept, placing the editor above the results. 
Personally I do not have any real opinion on this. I'll include it in the 
next release and see how people react. It's always good to explore different 
concepts.
About not clearing the selection when you press "run" - I think in the long 
run it should probably be configurable. My rough idea on the console window 
is/was, that it's what you use for short simple interactions with R, while 
you would use one or more "Command Editor window"s for more complicated 
stuff. In that case of use, it's actually nicer to clear the commands in the 
console window once submitted. However, obviously people differ in how they 
use an application. For now - once again, I'll take your patch as is.

> If it's OK with you, I'll go on playing with the R
> console, adding menu entries to load, save, etc.

Of course that's ok with me! However, as a note of caution: please don't 
overdo it. For a true editor you'd still use the Command Editor window. So 
load/save/cut/copy/paste etc. are all nice and useful in the console window, 
but personally I think extended options such as line-numbers, indentation 
tools, etc. should be reserved for the Command Editor window, in order to 
keep the GUI in the console window relatively simple.
Even undo/redo should certainly be available as keyboard-shortcuts in the 
console window, but it might actually be wise, not to add them to the "Edit" 
menu there, in order to avoid having users think you can use them to 
undo/redo the commands themselves instead of just the edited text.
BTW, technical note: If you want to add features like 
cut/copy/paste/undo/redo, you'll have to add corresponding simple wrapper 
functions to RKCommandEditor. You will note that this class is really simple 
and basically just wraps a Kate::Document. All the needed functionality 
already exists, but simply needs a wrapper. The relevant API documentation is 
here:

http://kate.kde.org/api/doc/html/index.php
http://developer.kde.org/documentation/library/3.3-api/interfaces/html/namespaceKTextEditor.html

One further comment on your patch:
 void submit_selectedCommand ();
The naming convention for member functions is to always use caps at word 
breaks, i.e.:
 void submitSelectedCommand ();
(for regular members it's underscores e.g.:
 int some_fancy_variable_name;
for classes and structs:
 class SomeClassName;)
I'm not good at following my own convention strictly, either, and you'll find 
a number of places where I used inconsistent naming. But of course using a 
consistent scheme is a good thing in general.

Looking forward to your patches!

Thomas




More information about the Rkward-devel mailing list