Smart Indent
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
Fix
Cool. I like how fast you get bugs fixed. *SO* much better than practically any other piece of software that I use!
The smart indenting should be fixed in the latest Zeus patch 
You can get the latest patch from here: http://www.zeusedit.com/forum/viewtopic.php?t=1000
Cheers Jussi

You can get the latest patch from here: http://www.zeusedit.com/forum/viewtopic.php?t=1000
Cheers Jussi
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
3.95z
What sort of changes should I be looking for in 3.95z v2? The history.txt file seems a bit out-of-date.
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
Smart Ident
Sweet! It looks like 3.96 is out. I guess I need to upgrade to that one. Does the patch work with the evaluation version?
Is Smart Indent still the same as the changed one, not how it worked before? I've been finding it real difficult to work with my cursor changing positions whenever I hit Enter. I'm still very much used to it staying lined up with the line above, as opposed to the line(s) below, or even back-tabbing just because there's a blank line above. I'm having to make a lot more corrections than I used to.
Hmm, thinking on that, is there any easy way to make a backspace delete a tab's worth of spaces when the line is empty? It would make moving around to put in closing braces a little easier. At least for C/C++/Java-like languages.
Is Smart Indent still the same as the changed one, not how it worked before? I've been finding it real difficult to work with my cursor changing positions whenever I hit Enter. I'm still very much used to it staying lined up with the line above, as opposed to the line(s) below, or even back-tabbing just because there's a blank line above. I'm having to make a lot more corrections than I used to.
Hmm, thinking on that, is there any easy way to make a backspace delete a tab's worth of spaces when the line is empty? It would make moving around to put in closing braces a little easier. At least for C/C++/Java-like languages.
Hi Alan,
If you download the latest Zeus Version 3.96a installer from the download page:
http://www.zeusedit.com/download.html
then the patch is included in this installer.
If you find it is not working, create a sample of code that illustrates the problem and post it to the forum. As an example I suggest something like this:
and then post examples code of what the smart indenting did and should have done.
Bind the function to the BackspaceEx key.
Write a macro that check the line length and calls BackspaceSmart or BackspaceEx.
Cheers Jussi
Does the patch work with the evaluation version?
If you download the latest Zeus Version 3.96a installer from the download page:
http://www.zeusedit.com/download.html
then the patch is included in this installer.
Whenever bugs are found in the smart indent they are fixed. As to whether this version includes any such bug fiexs I can say since I don't remember.Is Smart Indent still the same as the changed one, not how it worked before?
I've been finding it real difficult to work with my cursor changing positions whenever I hit Enter.
If you find it is not working, create a sample of code that illustrates the problem and post it to the forum. As an example I suggest something like this:
Code: Select all
int my_example()
{
if () {|
Hit enter here.
some code here;
}
Hmm, thinking on that, is there any easy way to make a backspace delete a tab's worth of spaces
Bind the function to the BackspaceEx key.
when the line is empty?
Write a macro that check the line length and calls BackspaceSmart or BackspaceEx.
Cheers Jussi
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
Smart Indent
I dunno how to do all that fancy stuff, but I'll see what I can do.
With the cursor at |, and I hit enter, the cursor indents. However, for any other {, the cursor does not indent. I'd like it to be consistent and not indent when I'm hitting enter to start coding the first line of a function.
With the cursor at |, and I hit enter, the cursor gives me the blank line that I need, but then backtabs back to line up with the }. That's annoying. I want it to stay lined up with the line above because all I am doing is putting in a black bit of whitespace but I still want to code within the block.
I hope this helps!
Code: Select all
int
adjust (NodeLst & vAdjs)
{|
Code: Select all
if (mAdj < 0)
{
makeAdjustment (pAdjNode);
|
} // if
I hope this helps!
Hi Alan,
In a new c/c++ file I find this:becomes this as expected:
and this:
becomes this as expected:
and this:
becomes this as expected:
and this:
becomes this as expected:
So at least for me this is how I expect the braces to work 
Note: I run with the braces set to normal mode and all smart and auto brace options enabled.

Try turning off the Auto Brace Indenting option.
Cheers Jussi
In a new c/c++ file I find this:
Code: Select all
int
adjust (NodeLst & vAdjs)
{|
Code: Select all
int
adjust (NodeLst & vAdjs)
{
|
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;|
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;
|
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;
if (some test)
{|
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;
if (some test)
{
|
}
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;
if (some test)
{|
other code:
}
}
Code: Select all
int
adjust (NodeLst & vAdjs)
{
some code;
if (some test)
{
|
other code:
}
}

Note: I run with the braces set to normal mode and all smart and auto brace options enabled.
With the Document Type, Template Panel, Auto Brace Indenting option checked Zeus will match brace against brace, meaning it will try to pair up the braces. So if you are finding the braces are not indenting correctly then it could be a bug in Zeus or it could also be that the braces in your code are not correctly pairedI hope this helps!

Try turning off the Auto Brace Indenting option.
Cheers Jussi
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
I don't do the smart bracing. I've got templates/macros for that. I type 'i' and hit F12 and get
so I don't *need* any smart bracing. It's all turned off. All I want is the cursor to line up with the line above, and nothing else.
Hmm, I just tried turning smart bracing on to see how that works. It's pretty sweet. I like that it *doesn't* put in a closing brace if there is already one there. Interestingly, if I turn on indented braces then it indents two tab stops. But this is 3.95z and there's an issue with the cursor disappearing whenever I bring up the Properties box so I think my system is a little bit flakey.
What I don't see you testing is my second case. Why does the cursor back-tab when you hit enter a second time?
Code: Select all
if (|)
{
} // if
Hmm, I just tried turning smart bracing on to see how that works. It's pretty sweet. I like that it *doesn't* put in a closing brace if there is already one there. Interestingly, if I turn on indented braces then it indents two tab stops. But this is 3.95z and there's an issue with the cursor disappearing whenever I bring up the Properties box so I think my system is a little bit flakey.
What I don't see you testing is my second case. Why does the cursor back-tab when you hit enter a second time?
Hi Alan,
So what you are seeing is not necessarily that the smart braces have been fixed, but rather you have not replicated the scenario that creates the bracing issue
When the smart bracing fails it is usually caused by a peculiar coding pattern not being correctly handled. So to fix these cases requires the particular pattern to be identified and then the problem reported.
That's why it's called SmartBracing


Cheers Jussi
There is a lot of code in Zeus that handles the smart bracing and the reason this is the case is there are many scenarios that need to be considered.Hmm, I just tried turning smart bracing on to see how that works.
So what you are seeing is not necessarily that the smart braces have been fixed, but rather you have not replicated the scenario that creates the bracing issue

When the smart bracing fails it is usually caused by a peculiar coding pattern not being correctly handled. So to fix these cases requires the particular pattern to be identified and then the problem reported.
I like that it *doesn't* put in a closing brace if there is already one there.
That's why it's called SmartBracing

Create a new file, add a minimal amount of code to replicate the issue and post it as a bug report, but make sure you also tell me what brace setting you configured.Interestingly, if I turn on indented braces then it indents two tab stops.
If you can replicate a Zeus bug at will, just post a bug report describing the bug. If I can then replicate the bug at this end I am more than happy to attempt to fix itBut this is 3.95z and there's an issue with the cursor disappearing whenever I bring up the Properties box

This is a bug that still needs to be fixedWhy does the cursor back-tab when you hit enter a second time?

Cheers Jussi
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
I don't use Smart Bracing. As cool as it is, I don't need that because I've got a buncha macros I developed way too many years ago to get around not having it. I'm sure it's handy for people who *didn't* use Brief for 10 years before Zeus came along.
As for the two-tab-stop thing. I did try it in a clean file and it does work fine. I dunno what happened that made it mess up on me. Hmmm, interestingly enough if you have braces unindented, then turn on Indent Braces and hit ENTER at the opening { then it *DOES* add in the extra } because there isn't already a matching one there. But I think that's only to be expected. I mean, who changes the bracing indentation in the middle of writing code?
The disappearing cursor is not a Zeus issue. It's been fine all these years that I've been using it. It's an XP problem with my machine.
And now that I know that the back-tabbing is a known issue I should shut-the-hell-up about it! :)
So yeah, the short form is that I don't use Auto Bracing and I'm just hoping for a check-box that turns off the new Auto Intenting and goes back to the old way. If the Auto Indenting is working the way that it is because of the Auto Bracing, even when the Auto Bracing is turned off, then maybe there's nothing that can be done about it.
As for the two-tab-stop thing. I did try it in a clean file and it does work fine. I dunno what happened that made it mess up on me. Hmmm, interestingly enough if you have braces unindented, then turn on Indent Braces and hit ENTER at the opening { then it *DOES* add in the extra } because there isn't already a matching one there. But I think that's only to be expected. I mean, who changes the bracing indentation in the middle of writing code?
The disappearing cursor is not a Zeus issue. It's been fine all these years that I've been using it. It's an XP problem with my machine.
And now that I know that the back-tabbing is a known issue I should shut-the-hell-up about it! :)
So yeah, the short form is that I don't use Auto Bracing and I'm just hoping for a check-box that turns off the new Auto Intenting and goes back to the old way. If the Auto Indenting is working the way that it is because of the Auto Bracing, even when the Auto Bracing is turned off, then maybe there's nothing that can be done about it.
Hi Alan,
But having said that Zeus has three brace modes and many brace options so I am only using one of many possible brace configuration. For me the brace configuration I use is working well, but that does not mean all the other possible configuration are also working well.
But without a bug report that fully describes the problem I have no chance of replicating the issue, which means these bugs will never be fixed
Cheers Jussi
Unfortunately the new code replaces the old code so there is no chance of adding a magic checkbox option to switch between the twoSo yeah, the short form is that I don't use Auto Bracing and I'm just hoping for a check-box that turns off the new Auto Indenting and goes back to the old way.

I'm not saying the new code is working correctly by any means. There is definitely the one know outstanding bug where the two enters cause the indent to be lost, but as far as I can tell this is the only know issue that needs to be fixed.If the Auto Indenting is working the way that it is because of the Auto Bracing, even when the Auto Bracing is turned off, then maybe there's nothing that can be done about it.
But having said that Zeus has three brace modes and many brace options so I am only using one of many possible brace configuration. For me the brace configuration I use is working well, but that does not mean all the other possible configuration are also working well.
But without a bug report that fully describes the problem I have no chance of replicating the issue, which means these bugs will never be fixed

Cheers Jussi
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
FYI, here's the macro I came up with. The problem with LUA is that I have to relearn it every time I write a macro because I write so few of them.
If you have any suggestions on how to "make it better", let me know. I'd particularly like to know how to handle LUA's returning a 'nil' value that in no way compares to an integer value and so requires a stupid amount of extra checking on things like string.find().
Code: Select all
--***************************************************************************
--
-- File: AS_Enter.LUA
--
-- Written by: Alan Stewart
--
-- Creation date: 09-Feb-07
--
-- Copyright (c) 2007, Alan Stewart. All rights reserved.
--
-- Zeus macro to ....
--
-- Modifications:
-- nn-xxx-07 AS -
--
-- Ideas:
-- -
function Enter ()
--debug_enable (); -- Turn on Zeus debugging
-- if (dofile ("AS_NotDoc.LUA") == 1) then return end -- if
screen_update_disable ()
EnterLine()
local L = get_line_pos() -- Line number
local C = get_cursor_pos() -- Column position
local L0 = L;
local text
local space
local nonspace
while (L > 0) do
L = L - 1
set_line_pos (L)
text = get_line_text()
nonspace = string.find (text, "%S")
if (nonspace ~= nil) then
if (nonspace > 0) then
C = nonspace
break
end -- if
end -- if
end -- while
set_line_pos (L0)
set_cursor_pos (0)
print (string.rep (" ", C-1))
screen_update_enable ()
screen_update () -- Force a refresh so cursor shows up correctly
end -- Enter
Enter ()
-
- Posts: 83
- Joined: Fri Jun 02, 2006 6:52 pm
Re: Smart Indent
So, it's been a while but lately, ever since I upgraded to 3.98wg, I've noticed that Smart Indenting wasn't working 100% the way my fingers were remembering it. So, I did some digging and found this ANCIENT post. I have been using Zeus for so long that I have completely forgotten all about any special key and macro mappings. But I dug out my copy of AS_Enter.LUA and poked at it and now I think I've found the exact solution to my problem!
It's a LOT shorter than my previous attempt, and it actually works! So I'll be using this from now on. I hope it can help someone else.
Code: Select all
screen_update_disable ()
local spaces = ""
_,_,spaces = string.find (get_line_text(), "(%s*)");
EnterLine()
print (spaces)
screen_update_enable ()
screen_update ()
It's a LOT shorter than my previous attempt, and it actually works! So I'll be using this from now on. I hope it can help someone else.