Author |
Topic: TAB Key (Read 751 times) |
|
mohsen
New Member
member is offline


Gender: 
Posts: 39
|
 |
TAB Key
« Thread started on: Nov 5th, 2008, 1:31pm » |
|
Why is the TAB key inactive in the IDE window? 
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: TAB Key
« Reply #1 on: Nov 5th, 2008, 3:42pm » |
|
Quote:Why is the TAB key inactive in the IDE window? |
|
What would you expect it to do? Indentation is automatic (and you're not allowed to have 'leading blanks' on a line) so it's not obvious to me what useful functionality it could have.
There's not even any way that TAB could insert the right number of spaces to align to a particular column (it would have to know by how much the line was going to be indented, which might depend on something after the TAB you haven't yet typed....).
I'm open to (practical) suggestions for something useful to do with that key, but I've not thought of anything up to now.
Richard.
|
|
Logged
|
|
|
|
mohsen
New Member
member is offline


Gender: 
Posts: 39
|
 |
Re: TAB Key
« Reply #2 on: Nov 5th, 2008, 5:30pm » |
|
Here is an example:
Code:
MS%=filestore% :REM MS%=memory start of file
DS%=Offset% :REM DS%=address start for display
REM PROCdebug(MS%)
ME%=MS%+limit% :REM ME%=memory end of file
DE%=DS%+limit% :REM DE%=address end of file for display
M%=MS% :REM M%= current actual memory position
D%=DS% :REM D%= current display Address position
SMS%=MS% :REM SMS%=first memory address of 1st line of current screen
SDS%=DS% :REM SDS%=first display address of 1st line of current screen
SME%=SMS%+TotalLines%<<2 :REM SME%=last line of displayed (memory)
SDE%=SDS%+TotalLines%<<2 :REM SDE%=last line of displayed (displayed)
line%=0 :REM start line
VDU23,128,24,24,24,24,24,24,24,24 :REM define char 128
PROCcreate_addresses
PROConescreen(0,TotalLines%,SMS%,SDS%):PROCdisplay_pos
When writing a well documented and well commented code, you need that to be easily readable.
Currently the above space before the REM has to be inserted by hitting the space bar which is time consuming and counter-productive.
The TAB key has a purpose in all Editors. It is the first time I come across a Professional Programme Eitor that suggests that the TAB key is an accessory on the keyboard :)
You can define the TAB key to insert a default number of spaces say 8 (user configurable). And, as a smart add-on to that, the TAB key will also move (by inserting spaces) to the position equal to the column of the previous line next colon ":" or semi-colon (in case of assembler) position. As stored tokens expand to different keyword lengths, the code to do the positioning is not staright forward as with plain text. But is doable and has been done before.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: TAB Key
« Reply #3 on: Nov 5th, 2008, 10:13pm » |
|
Quote:The TAB key has a purpose in all Editors. |
|
It's had no purpose in the BB4W editor for more than seven years, and I can't remember anybody else having drawn attention to it!
Quote:And, as a smart add-on to that, the TAB key will also move (by inserting spaces) to the position equal to the column of the previous line next colon ":" or semi-colon (in case of assembler) position. |
|
As I explained, I believe that to be virtually impossible, not just difficult! To work out how many spaces to add it is necessary to know by how much the line will be indented. The amount by which it is indented may change as a result of something you type after pressing TAB.
So for that to work, either it needs a time machine to look into the future (!), or it would have to 'backtrack' and modify the number of inserted spaces after the rest of the line is typed.
Anyway, it's a moot point. The program editor is so complex and difficult (even for me) to understand, that I wouldn't dare make such a major alteration for fear of introducing a bug.
No doubt it would be possible (and relatively safe) to configure the TAB key to insert a fixed number of spaces (say 8) but it's not something I plan to do.
Richard.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: TAB Key
« Reply #4 on: Mar 3rd, 2009, 09:24am » |
|
Quote:No doubt it would be possible (and relatively safe) to configure the TAB key to insert a fixed number of spaces (say 8) but it's not something I plan to do |
|
In BBC BASIC for Windows version 5.90a the TAB key can be programmed to execute an editor macro. A utility (SETTAB.BBC) is provided to program it to move the cursor to a specified column, with the proviso mentioned earlier in the thread that it won't work correctly if the indentation changes.
Richard.
|
|
Logged
|
|
|
|
|