Bug 51611 - Macros: Cursor's GotoEndOfWord selects dot
Summary: Macros: Cursor's GotoEndOfWord selects dot
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: Other All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2012-07-01 01:39 UTC by Mirosław Zalewski
Modified: 2022-12-22 11:32 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mirosław Zalewski 2012-07-01 01:39:50 UTC
Problem description: 
Function GotoEndOfWord selects dot after the word.
Please try following macro:
#v+
Sub Main
Dim sText As String
xDoc=ThisComponent
oText=xDoc.Text
xSelection = xDoc.CurrentController.getSelection
xRange=xSelection(0)
xCursor=xRange.getText.createTextCursorByRange(xRange)
xCursor.gotoStartOfWord(False)
xCursor.GotoEndOfWord(True)
sText=xCursor.GetString()
msgbox("sText:" + sText)
End Sub
#v-

When cursor is in word that ends with dot, dot is treated as part of word and displayed. I have also checked other characters:
, : ; | „ ” " ` ' ] ) -
every one of these is not treated as part of the word by above macro.

Dot is NOT selected when I double-click in middle of the word.

This may or may not be related to #49629

Expected behavior:
Dot is definitely not part of word, so it should not be treated as such.

Platform (if different from the browser): 
Browser: Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.10.289 Version/12.00
OS: Debian wheezy (testing) amd64
LO: 3.5.4 from Debian repo
Comment 1 bfoman (inactive) 2013-01-21 11:33:23 UTC
Confirmed with:
LO 4.0.0.1
Build ID: own W7 debug build
Windows 7 Professional SP1 64 bit

Dot is treated as part of word and displayed.
Comment 2 QA Administrators 2015-02-19 15:34:50 UTC Comment hidden (obsolete)
Comment 3 Buovjaga 2015-03-07 12:21:31 UTC
Confirmed.

Win 7 Pro 64-bit, LibO Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Locale: fi_FI
Comment 4 tommy27 2016-04-16 07:24:22 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-05-22 13:25:18 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2019-08-11 10:30:46 UTC
Still repro.

Arch Linux 64-bit
Version: 6.4.0.0.alpha0+
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019
Comment 7 Andreas Heinisch 2019-08-29 10:47:32 UTC
https://gerrit.libreoffice.org/#/c/78269/
Comment 8 Xisco Faulí 2020-02-17 10:54:55 UTC
(In reply to Andreas Heinisch from comment #7)
> https://gerrit.libreoffice.org/#/c/78269/

Restored in gerrit
Comment 9 Xisco Faulí 2020-07-22 15:19:45 UTC
(In reply to Andreas Heinisch from comment #7)
> https://gerrit.libreoffice.org/#/c/78269/

Hello Andreas,
I restored the patch in gerrit and I tried to rebase it but there are merge conflits, could you please resolve them ? Sorry for the inconviniences
Comment 10 Andreas Heinisch 2020-08-17 14:17:03 UTC
Hello Xisco,

does this patch have any chance to get merged? Otherwise it won't be the first item on my todo list :)

Best regards!
Comment 11 QA Administrators 2022-08-23 04:02:41 UTC Comment hidden (obsolete)
Comment 12 Andreas Heinisch 2022-08-23 19:18:31 UTC
Still in:
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 0de37cdd0251a7fc080bc6b95ac8708833bd0552
CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL
Comment 13 Andreas Heinisch 2022-12-22 11:32:17 UTC
This bug could be solved now since we have change the whitespaces to from u_isWhitespace to u_isUWhiteSpace. However, I am not completely sure what gotoStartOfWord should do or select since it includes abbreviations.

For instance:
My name is Dr. Foo Bar.

If you place the cursor into the word "Dr.", it will select the entire word including the punctuation. The same holds for the second word ("Bar."). If we change the algorithms, we have "Dr" (without punctuation) and "Bar".

Which one is correct here?