Bug 141783 - ViewCursor does not work as expected
Summary: ViewCursor does not work as expected
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-20 17:58 UTC by Regina Henschel
Modified: 2024-04-19 08:22 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Contains macro with ViewCursor (16.87 KB, application/vnd.oasis.opendocument.text)
2021-04-20 17:58 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-04-20 17:58:20 UTC
Created attachment 171319 [details]
Contains macro with ViewCursor

Open attached document. It contains a macro to investigate the ViewCursor.

Problems:

(A) The method gotoEndOfLine() does not set the cursor at the end of the line.

(B) The reported position is not "the cursor's coordinates relative to the top left position of the first page of the document." as said in the API of XTextViewCursor. It seems to be relative to the top left of the work area. Make the window wider to get free area left of the page and vary it. You get different position values.
Comment 1 Buovjaga 2022-04-19 06:07:43 UTC
(In reply to Regina Henschel from comment #0)
> Created attachment 171319 [details]
> Contains macro with ViewCursor
> 
> Open attached document. It contains a macro to investigate the ViewCursor.
> 
> Problems:
> 
> (A) The method gotoEndOfLine() does not set the cursor at the end of the
> line.

For me, it sets the cursor to the end of the first line (not end of paragraph). I also tested with 7.2 to confirm there was no change in behaviour.

Where does the cursor land for you?

> (B) The reported position is not "the cursor's coordinates relative to the
> top left position of the first page of the document." as said in the API of
> XTextViewCursor. It seems to be relative to the top left of the work area.
> Make the window wider to get free area left of the page and vary it. You get
> different position values.

I confirm this variance.

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 216493f32236f0086f4c5b527deb18b020b0ed1c
CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 2 Regina Henschel 2022-04-19 09:15:09 UTC
(In reply to Buovjaga from comment #1)
> (In reply to Regina Henschel from comment #0)
> > Created attachment 171319 [details]
> > Contains macro with ViewCursor
> > 
> > Open attached document. It contains a macro to investigate the ViewCursor.
> > 
> > Problems:
> > 
> > (A) The method gotoEndOfLine() does not set the cursor at the end of the
> > line.
> 
> For me, it sets the cursor to the end of the first line (not end of
> paragraph). I also tested with 7.2 to confirm there was no change in
> behaviour.
> 
> Where does the cursor land for you?

It sets it before the first character in the second line of the page. But API description is "moves the cursor to the end of the current line."
To test it you need to comment out the second part of the macro, so that the cursor is only affected by the gotoEndOfLine() method.
Tested in Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: a3988b2d147a2442b348d58b79dbd6e71472b7af
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 3 Buovjaga 2022-04-19 09:18:06 UTC
(In reply to Regina Henschel from comment #2)
> It sets it before the first character in the second line of the page. But
> API description is "moves the cursor to the end of the current line."
> To test it you need to comment out the second part of the macro, so that the
> cursor is only affected by the gotoEndOfLine() method.

Ok, I can repro like that
Comment 4 QA Administrators 2024-04-19 03:15:49 UTC Comment hidden (obsolete)
Comment 5 Regina Henschel 2024-04-19 08:22:43 UTC
The problem is still as described in Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d76f1877f699c91f5e4a020641c6d65064bfb997
CPU threads: 32; OS: Windows 10.0 Build 22631; UI render: default; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded