Smart Indent

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Smart Indent

Post by AlanStewart » Thu Oct 19, 2006 10:09 pm

You'll be pleased to know that I've gone all day now without Zeus giving me grief. I dunno what was happening over the past couple days but I figure you gotta be sick of me sending you error dumps by now! :)

Something I've been noticing is that the Smart Indenting seems to have changed from previous incarnations. In the Doc Properties / Template tab, I've got Smart Indenting turned on and Normal Braces selected, but if I've got an open brace at the end of a line and I put the cursor right before it and hit enter to move it down a line, it gets indented instead of going right under the previous line. Now, I'm all for indented braces (it just makes *sense*) but unfortunately the coding standard here at work says that braces line up with the keyword (C++/Java) so it's kinda a pain to have braces being automatically indented. Especially when I'm pretty gosh darned sure that it didn't behave like that in any other version of Zeus that I've used.

Of course, I could be wrong. Just askin', y'know?

Alan Stewart

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Smart Indent?

Post by AlanStewart » Thu Oct 19, 2006 10:59 pm

Or maybe I'm wrong. Maybe it *is* working okay for code but not for function headers?

void
SomeClass::someFunction (int someParameter)
{
...// Some comment.
}

Okay, a little bit of experimenting showed that it's indenting to the line *below* instead of the line above. If you take the code above and change it to

SomeClass::someFunction (int someParameter) <cursor>{

and then hit return, you'll get the { indented to match the indentation of the comment. But if the comment isn't there, or there's a blank line right before the comment, then Zeus puts the brace right in column 1, like a good little text editor. Okay. Got that figured out!

Alan

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

Post by jussij » Fri Oct 20, 2006 12:07 am

Hi Alan,
Something I've been noticing is that the Smart Indenting seems to have changed from previous incarnations.

The Smart Indenting has been enhanced :)
I'm pretty gosh darned sure that it didn't behave like that in any other version of Zeus that I've used.

Get the latest Zeus from here: http://www.zeusedit.com/forum/viewtopic.php?t=975

This latest version has the option to turn on/off the auto brace indenting.

In any case it might also indent you header file example correctly, but if this is not the case, feel free to keep posting examples of where the smart bracing is going wrong ;)

Cheers Jussi

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Fri Oct 20, 2006 1:16 am

[quote]Get the latest Zeus from here: http://www.zeusedit.com/forum/viewtopic.php?t=975[/quote]

I've got 3.95y. That's the first thing I check for whenever I have problems. Make sure I've got the latest version!

[quote]This latest version has the option to turn on/off the auto brace indenting. [/quote]

Where is this option? I already have "Normal Braces" set instead of the "Indent Braces" so I'm not sure where to look for other Smart Indenting options.

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

Post by jussij » Fri Oct 20, 2006 2:16 am

I've got 3.95y. That's the first thing I check for whenever I have problems. Make sure I've got the latest version!

You will need to get the patch again ;)

As is usually the case the 3.95y version was ready to go and tested for about a week, before being uploaded, the links updates and the announcements made.

Then sure enough two days later I found a similar brace bug to the one you described, so I uploaded a new replacement 3.95y version.

Now I should have released this as a 3.95z release, but since each patch release requires quite a bit of extra work in getting links updated etc, I decided against this and just replaced the existing file.

Cheers Jussi

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Fri Oct 20, 2006 6:08 pm

[quote]You will need to get the patch again ;)[/quote]

I just got it. And yes, there was an update so that's cool now. Unfortunately it appears that the same bracing issue is there. Oh well, it's not that big of a deal for now. Here's hoping macros are a little more stable now. I'll email you any dumps should things die on me at any time.

So what's the next revision? 3.95aa, 3.96, or 3.96a? :)

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

Post by jussij » Fri Oct 20, 2006 10:53 pm

if I've got an open brace at the end of a line and I put the cursor right before it and hit enter to move it down a line, it gets indented instead of going right under the previous line.

This is actually not the smart bracing in action, but rather the smart indenting. All that has happened is the new line has been indented to match the indentation of the next line. What probably should have happened is Zeus should have done smart bracing and positioned the brace to match the indentation of the matching brace :?)

In any case what I would suggest is binding the EnterLine function to something like Ctrl+Enter key and use this key when you need no special indenting. The EnterLine will do a plane an simple enter without the any of the smarts. Naturally to remove the smarts all together you could also bind EnterLine to the Enter key ;)

Cheers Jussi

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Sat Oct 21, 2006 12:31 am

[quote]What probably should have happened is Zeus should have done smart bracing and positioned the brace to match the indentation of the matching brace :?)[/quote]

Maybe that would do it. It would just be a matter of finding the closing brace at the end of the function I guess.

Here's another one. Start with this:

...if (sprite = GetSprite ("Sprite"))
......sprite->bActive = false;

Now, just to confuse matters, put the closing brace in *first*, ie. this:

...if (sprite = GetSprite ("Sprite"))
......sprite->bActive = false; }

What I end up with instead, is this:
...if (sprite = GetSprite ("Sprite"))
......sp}rite->bActive = false;

Cool, eh!

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Wed Oct 25, 2006 2:20 am

What's the equivalent of
MoveLineHome ()
where it *DOESN'T* do the "smart" indenting? I've been running macros with that in it to put stuff right at the left-hand edge, but if there's an indented line below where I'm working then it all gets indented, which of course isn't what I wanted.

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

Post by jussij » Wed Oct 25, 2006 3:48 am

Hi Alan,
What's the equivalent of MoveLineHome () where it *DOESN'T* do the "smart" indenting?

I am not exactly sure what you mean. The MoveLineHome should not do any smart indenting :?

For example, given this very Lua simple macro:

Code: Select all

function key_macro()
    MoveLineHome()
end
key_macro() -- run the macro
If I run this macro on any of these lines the cursor moves to the home location:

Code: Select all

  this is a test line
     this is a test line
         this is a test line
I've been running macros with that in it to put stuff right at the left-hand edge, but if there's an indented line below where I'm working then it all gets indented
Have you got a simple macro that illustrates this problem :?:

Cheers Jussi

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Fri Oct 27, 2006 6:19 pm

I am not exactly sure what you mean. The MoveLineHome should not do any smart indenting :?

- It doesn't, but any \n printed *DO* do the smart indenting.

Have you got a simple macro that illustrates this problem :?:

- Yup!

function key_macro()
MoveLineHome()
print ("*\n")
print ("**\n")
print ("***\n")
end
key_macro() -- run the macro

I guess, really, what I'm whining about , is that I've gotten used to the old smart indent where it basically just indented to the line above (ignoring blank lines) and am having difficulties adjusting to the new one that seems to look to the lines below, or something. I'm used to entering an indented line of code, hitting RETURN a couple of times to get a blank line, then doing another line of code, all at the same indent level. Now, the second time I hit RETURN, the second blank line ends up out-dented and that's not what I what.

Don't you hate traditionalists! :)

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

Post by jussij » Fri Oct 27, 2006 10:07 pm

It doesn't, but any \n printed *DO* do the smart indenting.
You can fix this quite easily. For example the following simple Lua script that will output text without any smart indenting:

Code: Select all

function PrintLine(text)
    print(text)
    EnterLine()
end

function key_macro()
    screen_update_disable()
    PrintLine("This is line #1")
    PrintLine("This is line #2")
    PrintLine("This is line #3")
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro
Jussi

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Sun Oct 29, 2006 8:22 am

Well, I suppose that's an okay fix. I just wasn't planning on having to edit all my macros to fix the auto indent. I think the fix I'll have to settle for is just making sure that the cursor is right over on the left and that there's a couple blank lines underneath where I want to insert stuff. That should fix things.

Thanks!

AlanStewart
Posts: 82
Joined: Fri Jun 02, 2006 6:52 pm

Post by AlanStewart » Fri Nov 03, 2006 1:18 am

Found another interesting thing. Try typing this into a Java or C++ program:

/// Playing the bet {0-9}NNN.

What happens?

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

Post by jussij » Fri Nov 03, 2006 2:26 am

This will be fixed in the next Zeus patch due some time in December ;)

Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 30 guests