issue-#99 Auto Upper Keywords

The features that we decide to not apply in the current time
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

issue-#99 Auto Upper Keywords

Post 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...
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#99 Auto Upper Keywords

Post 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.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#99 Auto Upper Keywords

Post by Ivan Denisov »

I prepared test version with you code
http://blackboxframework.org/unstable/i ... a1.399.zip

Everybody, please try and comment.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#99 Auto Upper Keywords

Post 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.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#99 Auto Upper Keywords

Post 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
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#99 Auto Upper Keywords

Post by DGDanforth »

I recommend using the "esc" key to undo the last capitalization.

-Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#99 Auto Upper Keywords

Post 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
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#99 Auto Upper Keywords

Post 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.
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#99 Auto Upper Keywords

Post 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
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#99 Auto Upper Keywords

Post 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
Post Reply