futurdorko has made some good suggestions in regard to gretl's
built-in script editor lately, and I've made some changes in CVS.
If people could beat on the new stuff and expose any bugs that
would be great.
The main thing is new handling of Tab and Enter. I've tried to
make these keys behave pretty much as they do in, say, Emacs' C
Tab: when the Tab key is pressed at the beginning of a line (or in
white space to the left of any non-space characters on a given
line), instead of simply entering a Tab character, try to
determine what the logical indent is for the current line, and
enter enough space characters to go to that indent.
Enter: when Enter is pressed, check the indentation of the line
being completed, and if it's not correct, adjust it.
So, for example, if you type
<Tab>if x > 3<Enter>
<Tab>print "x > 3"<Enter>
<Tab>print "x <= 3"<Enter>
if x > 3
print "x > 3"
print "x <= 3"
This assumes the default of 4 spaces per "Tab", but if you
right-click in the editor window you get a configure option in the
popup menu that lets you set this value from 2 to 8 spaces.
You also get the option of turning off the "smart" Tab behavior
if you don't like it; and if you have an existing script open in
the editor you get the option of applying "canonical" indentation
to the whole thing.
Show replies by date
Very nice job Allin!
I'm doing some tests on it, and i'll post my remarks as soon as possible.
It seems working fine. Just a couple of things that could be changed.
In smart tab mode pressing ENTER after any right gretl tag/statement should
behave like it was ENTER and then TAB. That will move the cursor at the new
line and at the right indented position.
If this wouldn't be the right position ( for example if the previous line
was the last one of an If branch) BACKSPACE should move the cursor one tab
back, and only one space.
In normal mode it would fine to keep the focus on the previously highlighted
code after each TAB/SHIFT^TAB. It will allow fast tab sliding for that code
Finally the icing on the cake..
In smart tab mode, selecting all the text and pressing TAB shouldn't
automatically indent what's inside a multi-line comments cause often what's
there is deliberately not indented.
Sorry it should have been:
..should move the cursor one tab back, and NOT only one space.