Indenting

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
john

Indenting

Post by john »

Hi

I'm a new user of Zeus and have encountered a problem in it's operation that I expect can be fixed but I cannot find the option to correct it.

The problem is with the smart indenting feature that I cannot turn off, I only want to turn it off as it doesn't appear to function as I expect.

if I have the following 2 lines

Function() // comment at the end of line
// comment spills over to this line

Now after the second line I'm taken to the spot under the // automatically if smart indenting is on, or when I hit tab if smart indenting is off. Now if smart indenting is off I expect tab to only go a tab stop (8 spaces) not all the way across.

Further with smart indenting on, my preference, I would expect that once taken to the point under the // I could backspace to where I wanted to be; this is an unusual case I admit. But the indenting has been done using spaces not tab stops, even though the whitespace between the function name and comment is a tab, so backspacing is a pain.

I suspect there is a an options I have to adjust to get this to work as I wish, Zeus does everything else I want :-), but I cannot find it any suggestions?

Thanks
Guest

Post by Guest »

Hi John,
The problem is with the smart indenting feature that I cannot turn off, I only want to turn it off as it doesn't appear to function as I expect.
...
I suspect there is a an options I have to adjust to get this to work as I wish, Zeus does everything else I want , but I cannot find it any suggestions?
What you are seeing is the TabSmart function in action.

To disable this feature use the Options, Editor Options menu and in the Keyboard Mapping section edit the currently active mapping and re-map the Tab key from the current TabSmart function to use instead the Tab function.

I would also suggest re-enabling the smart indenting and smart bracing options, as I think you will find these forms of indenting quite useful. These indenting options are triggered by the enter key.

Cheers Jussi
John

Post by John »

Hi Jussi

Well that fixed half the problem. I remapped Tab to Tab and TabSmart to Ctrl+Tab.

Unfortunately when it lines me up under the comment line, as in the first post, it is still full of spaces not tabs so backspacing remains a pain. I've made sure the option to turn tabs into spaces is NOT set.

Anything else you can think of I'm missing?

Thanks

john
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Unfortunately when it lines me up under the comment line, as in the first post, it is still full of spaces not tabs so backspacing remains a pain. I've made sure the option to turn tabs into spaces is NOT set.

Unfortunately there is no option to change this behavour since Zeus is actually designed to work this way :(

When Zeus smart indents it copies the whitespace from the line above to fill in the white space of the newly indented line. So if you have space characters in the indenting of the new line you must have have space characters in the line above. Zeus works this way to support languages like Python where it is in fact a syntax error to have white space that is not consistent for all lines.
Anything else you can think of I'm missing?

The only other solution is to write a macro script to replace the current smart indenting. A similar example of how todo this can be found in this indenting posting.

As a starting point consider this very simple Lua script that inserts a new line and then insert one tab character. With some more refinement it could be made to work in a similar manner to the Zeus smart indenting but using real tabs only.

Code: Select all

function key_macro()
  screen_update_disable()

  -- insert CRLF with cursor at BOL
  EnterLine()

  -- insert a Tab character
  TabHard()

  screen_update_enable()
  screen_update()
end

key_macro() -- run the macro
Cheers Jussi
John

Post by John »

Hi Jussi
When Zeus smart indents it copies the whitespace from the line above to fill in the white space of the newly indented line. So if you have space characters in the indenting of the new line you must have have space characters in the line above. Zeus works this way to support languages like Python where it is in fact a syntax error to have white space that is not consistent for all lines.
Well this was my guess but In the case I posted and in a case I just tetsted the line where I hit return has tabs in it, not spaces. But the whitespace inserted by Zeus is spaces. This can be demonstrated by me creating a new document, hitting tab then typing a word and hitting return.I'm correctly taken to the point under the word but when I backspace it is spaces.

But I notice that if the indenting is correct and I do a few more lines then go back up a line or two the spaces have been converted into tabs. Ahhh! Zeus does the right thing with the whitespace except on the line just created, which is the one I need to alter.

But playing with it I see tha Shift Tab moves me back a tab space and if I just start typing at this new location it all works as I'd expect.

Cheers

John
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi John,
This can be demonstrated by me creating a new document, hitting tab then typing a word and hitting return.
But this is a special case :)

Since the tab was entered on the first line of the document, Zeus has no "line above" to use as a guide on how to fill in the tab. So in this case it goes to the Document Type and looks at the "Tabs as spaces" option. If this option is on then it fills the tab with white space, but if it is off it fills the tab with a tab character.
But playing with it I see tha Shift Tab moves me back a tab space and if I just start typing at this new location it all works as I'd expect.

It is good to read Zeus is now working just the way you want it to work.

Zeus is highly configurable which can make it seem overly complicated. But with just a little tweaking it is almost always possible to make Zeus work just the way you want it to work :)

Cheers Jussi
Post Reply