BUG: LotusScript / Editor / Do-loop indent wrong

Hi all,

the indent in the next line of the editor after a DO-statment without(!) any further argument is wrong; there should be an indent, but there is nothing, neither indent, nor outdent. This also has an impact on the format of the following script code.

Thought already there would be something wrong in my code, cause the hierachical structur of the script didn’t fit at the end.

i.e.:

(wrong)

Do

something

loop while not finished

(ok)

do while not finished

something

Loop

Subject: RE: BUG: LotusScript / Editor / Do-loop indent wrong

Clearly you’re not expecting a workaround, so you must be thinking of this as a bug report.

Nobody is assigned to take action on bugs reported here. This is a user forum, not an error tracking system. If you have a bug to report, call Support.

Subject: Does not happen to me. Copied this code straight out of the code editor.

Sub Click(Source As Button) x = 100

Do

	x = x - 1

Loop Until x = 7

End Sub

Subject: RE: Does not happen to me. Copied this code straight out of the code editor.

It should – if you inject a Do (or an If, While, For, Forall, …) into the midst of existing code without hitting Enter (using the arrow keys to navigate lines). This is a UI-only issue, and is very, very temporary. If you navigate to a different sub/function then back again, the code will be indented properly IF there’s a matching end-block statement.

Subject: Sure, now I get it. Just like you do a shift down arrow and delete an If…Then line, then…

down arrow a couple of times. First line gets proper indentation, ones below do not. I use to rectify.

Subject: RE: Sure, now I get it. Just like you do a shift down arrow and delete an If…Then line, then…

Try a Loop with no parameters, and put a comment after it. I couldn’t figure out how a block of code compiled when obviously something was missing, but it was just an indentation bug. It comes out like this:

Do Until EndOfTime

Stuff

Loop '

Even just a blank comment like that will throw it out, and everything that comes after it. Kind of annoying. Nothing will fix it. Just put your comments on the line above or below.

Subject: Well then have a look at his code . . .a shift down arrow and delete an If…Then line, then…

Hi,

I think keeping other users informed about little bugs is one of the tasks for such a forum, right? This can sometimes save time.

Btw. Unfortunatly I havn’t got any email from this forum though I wanted to be informed. That’s why I answer so late. My apologies.

Here is a method where I first detected this problem. It seems that it only appears if one has a more complex (hierachical) code (i.e. a class method). I have flagged the code in question with a <<<<<<<<<------ char sequence. It will not(!) automatically be corrected even if one saves the script library and reopens it. Just copy the below class code into the Declarations Section of a new empty Scriptlibrary.

Heres ist he code:

Class sort

Firstindex As Integer

LastIndex As Integer

Mlimit As Integer

MAS As Integer

upward As Integer

Stack As StackObj

'-----------------------------------------------------		

Public Sub Sort(tbl As Variant)

	Dim pivot As Variant	

	Dim f%,l%,first%,last%,first1%,last1%,c%

	Dim limits As Variant

	If Me.FirstIndex<>Me.LastIndex Then

		First1%=Me.FirstIndex

		Last1%=Me.LastIndex

		Me.Firstindex=0

		Me.LastIndex=0

	Else

		First1%=Lbound(tbl)

		Last1%=Ubound(tbl)

	End If

	

	If Me.MAS=True Then								'Multiple Array Sort: Create order array

		Redim order (first1% To last1%)

		For f%=first1% To last1%

			order(f%)=f%

		Next			

	End If

	

	Redim limits(0 To 1)

	limits(0)=first1%

	limits(1)=last1%

	

	Set Stack=New StackObj(10,20)

	Call Stack.Push(limits)

	

	Do While Stack.Pointer>0

		Call Stack.pull (limits)

		first%=limits(0)

		last%=limits(1)

		f%=first%

		l%=last%			

		If last%-first%<Me.Mlimit Then					'Use above n Elements Quicksort, below Bubblesort

			Bubblesort tbl, first%,last%				

		Else		

			pivot =Chosepivot 	(tbl, first%,last%)		'Quicksort, find a "good" center/pivot		

			If upward=True Then

				Do 								'<<<<<<< ---------upward

				Do While tbl(f%)<pivot

					f%=f%+1

				Loop

				Do While tbl(l%)>pivot

					l%=l%-1

				Loop

				If f%<=l% Then

					swap tbl , f%, l% 

					f%=f%+1

					l%=l%-1

				End If

			Loop While f%<l%

		Else

			Do 								'<<<<<<<--------downward

			Do While tbl(f%)=>pivot

				f%=f%+1

			Loop

			Do While tbl(l%)<pivot

				l%=l%-1

			Loop

			If f%<=l% Then

				swap tbl, f%, l%

				f%=f%+1

				l%=l%-1

			End If

		Loop While f%<l%

	End If

	If f%>l% Then

		c%=f%

		f%=l%

		l%=c%

	Else

		If tbl(f%)>pivot Then

			l%=f%

			f%=f%-1

		Else

			l%=f%+1

		End If

	End If

	If first%<f% Then 		'lower segment

		limits(0)=first%

		limits(1)=f%

		Call Stack.push (limits)

	End If

	If l%<last% Then 		'upper segment

		limits(0)=l%

		limits(1)=last%

		Call Stack.push (limits)

	End If

End If

Loop

End Sub

'-----------------------------------------------------		

Sub Bubblesort (tbl As Variant, first%,last%)

	

End Sub

'-----------------------------------------------------		

Sub swap (tbl As Variant , f%, l% )

	

End Sub

'-----------------------------------------------------		

Function Chosepivot	(tbl As Variant, first%,last%)

	

End Function

'-----------------------------------------------------		

’ . . .

End Class

Class StackObj

Private stackpointer As Integer

'-----------------------------------------------------	

Sub New(Ststep%,MDepth%)

End Sub

'-----------------------------------------------------	

Public Sub push(v As Variant)

End Sub

'-----------------------------------------------------	

Public Sub Pull (v As Variant)

End Sub

'-----------------------------------------------------

Public Property Get Pointer As Integer

	Pointer=stackpointer

End Property

'----------------------------------------------------

End Class