Issue 13564 - collapseToStart() and collapseToEnd() both set the cursor to the rightmost position
Summary: collapseToStart() and collapseToEnd() both set the cursor to the rightmost po...
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: stephan.wunderlich
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-17 21:29 UTC by andrew
Modified: 2013-02-24 21:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description andrew 2003-04-17 21:29:22 UTC
Using Windows XP version 1.0.3

I entered some text in a write document such as

0123456789

Now, place the cursor between 4 and 5 and select the characters 34. Run the 
macro. The text "5" will be selected and printed so that I know that
collapseToEnd() moves both the start and end cursor to the space between 4 and 
5. The same thing happens if you use collapseToStart(). Is this a bug or am I 
missing something?

Now, place the cursor between 2 and 3 and select the characters 34. The same 
behavior is noted as seen above!

Conclusion: Both collapseToStart() and collapseToEnd() set the cursor to the 
rightmost position. Although I can use this information, to achieve my goals, 
it seems incorrect.


Sub CollapseError
	Dim lSelCount&, oSelections As Object, oSel As Object
	Dim oText As Object, oStartCursor As Object, oEndCursor As Object
	Dim iWhichSelection As Integer, i%
	
	oSelections = ThisComponent.getCurrentSelection()
	oText = ThisComponent.Text
	lSelCount = oSelections.getCount()
	For iWhichSelection = 0 To lSelCount - 1
		oSel = oSelections.getByIndex(iWhichSelection)
		oStartCursor = oText.CreateTextCursorByRange(oSel)
		If Not oStartCursor.isCollapsed() Then
			'?? collapse to start and end yield the same result
			oStartCursor.collapseToEnd()
			'oStartCursor.collapseToStart()
			oStartCursor.goRight(1, True)
			MsgBox "Cursor text = " + oStartCursor.getString()
			i = oText.compareRegionEnds(oStartCursor, oSel)
			Print "Compare Ends of Cursor and Sel yields " + i
			i = oText.compareRegionStarts(oStartCursor, oSel)
			Print "Compare starts of Cursor and Sel yields " + i
		End If
	Next
End Sub
Comment 1 andrew 2003-04-17 21:31:34 UTC
This is a scripting issue
Comment 2 ab 2003-04-25 14:35:19 UTC
This is (most probably) no scripting but an API problem because
isStartOfWord seems to return false values. But not only if the
call comes from Basic.

Comment 3 ab 2003-04-25 14:44:44 UTC
Sorry, I copied my comment from i13565. Here isStartOfWord
is not involved of course, but otherwise the comment still
is correct... :-)
Comment 4 thomas.lange 2003-05-15 09:32:31 UTC
Already fixed in current version (644 m13) should be OK in OO 1.1 Beta2.

TL->SW: Please check and close.
Comment 5 stephan.wunderlich 2003-05-16 13:49:31 UTC
SW: works as expected in srx644m13 => fixed, I will recheck it when
the snapshot is available on OpenOffice
Comment 6 stephan.wunderlich 2003-05-20 11:54:24 UTC
SW: works as expected in OOo1.1beta2 => closed