Page 1 of 2

issue-#99 Auto Upper Keywords

Posted: Tue Jan 26, 2016 7:06 am
by Ivan Denisov
http://redmine.blackboxframework.org/issues/99

I think, that it is important feature. It is because modern languages not using upper-case for command words. So for many programmers is difficult to use Shift key in the keyboard. I also think, this it is a kind of anatomical discrimination. There are people with short little fingers. It is very difficult for them to type code in Pascal family languages...

Re: issue-#99 Auto Upper Keywords

Posted: Tue Jan 26, 2016 9:29 am
by luowy
KWord procedure can be a public procedure variable ,
other oberon/modula2 language provide a KWord procedure to config it.
then BB can satisfied all language need.

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 6:12 am
by Ivan Denisov
I prepared test version with you code
http://blackboxframework.org/unstable/i ... a1.399.zip

Everybody, please try and comment.

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 6:20 am
by Ivan Denisov
The problem I found is that if you want to write some words inside the quoted string
"if module is ..."
you will get
"IF MODULE IS ..."

So this auto-upper should detect if you type inside quoted string.

Also if you preparing some documentation, you will not want auto-upper doing it's job.
So it should work only if textView started with MODULE word.

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 7:03 am
by DGDanforth
Ivan Denisov wrote:The problem I found is that if you want to write some words inside the quoted string
"if module is ..."
you will get
"IF MODULE IS ..."

So this auto-upper should detect if you type inside quoted string.

Also if you preparing some documentation, you will not want auto-upper doing it's job.
So it should work only if textView started with MODULE word.
More than that it should allow such constructs as
TYPE
module = ARRAY OF CHAR;
real = RECORD x: REAL END;
etc.
without capitalization.

So one needs either (1) a context sensitive capitalizer or (2) a one key "Undo last autocapitalized word".

Other than that I tried it and like it!
-Doug

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 7:43 am
by DGDanforth
I recommend using the "esc" key to undo the last capitalization.

-Doug

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 8:39 am
by Josef Templ
Sorry, but to me this issue is a complete nonsense.
The problem it tries to solve is nonsense and the solution is nonsense.
If entering keywords needs to be sped up there are much better solutions
available then fiddling with the keywords and creating incompatibilities in
existing source code. Note: if you have a variable named "end" this would be
a key word now. Has this been considered?

Don't do this. There is no need for it.
There are much better and less destructive alternatives.

- Josef

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 8:59 am
by luowy
Josef Templ wrote:Sorry, but to me this issue is a complete nonsense.
The problem it tries to solve is nonsense and the solution is nonsense.
If entering keywords needs to be sped up there are much better solutions
available then fiddling with the keywords and creating incompatibilities in
existing source code. Note: if you have a variable named "end" this would be
a key word now. Has this been considered?

Don't do this. There is no need for it.
There are much better and less destructive alternatives.

- Josef
we are waiting you give us a better solution.

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 9:01 am
by Robert
Ivan Denisov wrote:Everybody, please try and comment.
As a generalisation I do not like this kind of automation.

Two alternatives:

- Implement a (Menu) Command that scans the Document and does it - I think there is a "Pretty Printer" in CPC already (CpcBeautifier ?).
- Have a Wrapper that does it as you type.

These approaches are optional for the user, and non-invasive for the Framework.

(What I would like is the option to turn OFF the automatic insertion of Tabs.)

Robert

Re: issue-#99 Auto Upper Keywords

Posted: Wed Jan 27, 2016 9:56 am
by Josef Templ
The better alternative is mentioned in Tutorial 5.
One way to make the above command more useful would be to accept a caret as input, instead of a selection. Then you could write a name and hit a keyboard shortcut for the command. The command then reads backwards from the caret position, until it finds the beginning of the name, and then substitutes the appropriate phone number for the name. This would be a simple way to implement keyboard macros.
At ETH we had such a feature built in to the text editor of the original Oberon system.
I don't remember all the details but the idea was to type in a macro name optionally preceded by a parameter and
then hit a special key that expands the macro, e.g. for a MODULE macro named 'm' with the name of the module as a parameter you would type:

Code: Select all

ModuleName m<MacroKey>
and this is expanded into something like:

Code: Select all

MODULE ModuleName;

IMPORT <caret is placed here>;

END ModuleName.
The macros are defined in a separate file and can be adapted/extended by the user.

Such a feature has the following advantages:
- It is useful for all users
- it is adaptable to the user's needs
- the speedup is maximized because multiple keywords can be inserted and the parameter is entered only once.
- it does not introduce incompatibilities in the language
- it does not have any magic and sometimes unwanted behavior.

- Josef