Bug 134654 - Alt+X: unable to select using keyboard immediately after converting to Unicode code
Summary: Alt+X: unable to select using keyboard immediately after converting to Unicod...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.1 rc
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.1.0 target:7.0.0.2 target:6.4.6
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-08 13:41 UTC by Mike Kaganski
Modified: 2020-07-15 08:02 UTC (History)
2 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 Mike Kaganski 2020-07-08 13:41:44 UTC
1. In a writer document, type 'abc'
2. Put cursor to the left of the 'a', and press Crtl+ArrowRight to select the 'a' character
3. Press Alt+X to convert the selected character into 'U+0061'
4. See that the cursor is between the '1' and 'b'
5. Press Crtl+ArrowRight to select the 'b' character

=> the cursor moves right without selecting the character.

Pressing arrow keys without Ctrl before using Crtl+ArrowRight restores normal operation.

Tested with Version: 7.0.0.1 (x64)
Build ID: 04ba7e3f1e51af6c5d653e543a620e36719083fd
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: de-DE (ru_RU); UI: en-US
Calc: CL
Comment 1 V Stuart Foote 2020-07-08 14:08:07 UTC
Can not confirm.

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 86884f876ed2c9e8d4690d8ae746de51f93e43d4
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

<Ctrl>+<R-cursor> positions to end of current 'abc'/'U+0061' string. Or if additional text is added to the start of the next word.

<Shift>+<R-cursor> makes a character selection--consistently. While <Ctrl><Shift>+<R-curson> selects through the next ICU word break.
Comment 2 Mike Kaganski 2020-07-08 14:11:44 UTC
Oh sorry, I cunfused the Ctrl and Shift. Please replace all occurrences of Ctrl with Shift in comment 0.

Corrected steps:

1. In a writer document, type 'abc'
2. Put cursor to the left of the 'a', and press Shift+ArrowRight to select the 'a' character
3. Press Alt+X to convert the selected character into 'U+0061'
4. See that the cursor is between the '1' and 'b'
5. Press Shift+ArrowRight to select the 'b' character
Comment 3 V Stuart Foote 2020-07-08 14:37:39 UTC
(In reply to Mike Kaganski from comment #2)
> Oh sorry, I cunfused the Ctrl and Shift. Please replace all occurrences of
> Ctrl with Shift in comment 0.
> 
> Corrected steps:
> 
> 1. In a writer document, type 'abc'
> 2. Put cursor to the left of the 'a', and press Shift+ArrowRight to select
> the 'a' character
> 3. Press Alt+X to convert the selected character into 'U+0061'
> 4. See that the cursor is between the '1' and 'b'
> 5. Press Shift+ArrowRight to select the 'b' character

OK, yes that happens--but only if the character being converted was selected before the <Alt>+X.  

Also selection to convert to Unicode is not necessary (just one glyph of string is converted -> Unicode point), it is needed to selectively convert multi-Unicode points -> string.  And watch out with strings of 3, 4 & 5 digit numbers.

But does happen in
Version: 6.4.4.2 (x64)
Build ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded

There it seems to be sensitive to the direction the selection is made (i.e. where the text cursor ends up in selection).
Comment 4 Justin L 2020-07-14 11:52:30 UTC
The hint for this bug report comes from bug 73691 comment 20's
> 3.) selection is not necessary, but if used will limit the input to those
> characters. (Draw/Impress/Calc have the final result selected, but not Writer.)

proposed fix at https://gerrit.libreoffice.org/c/core/+/98719

I tested this with some of the complex combining characters from attachment 117731 [details]. (Somewhat irrelevant, since Writer doesn't use selection AT ALL for toggling.)
Comment 5 Mike Kaganski 2020-07-14 12:34:17 UTC
(In reply to V Stuart Foote from comment #3)
> Also selection to convert to Unicode is not necessary (just one glyph of
> string is converted -> Unicode point), it is needed to selectively convert
> multi-Unicode points -> string.  And watch out with strings of 3, 4 & 5
> digit numbers.

(In reply to Justin L from comment #4)
> (Somewhat irrelevant, since Writer doesn't use selection
> AT ALL for toggling.)

Sorry, I fail to follow; maybe I just misunderstand that. But as far as I know, Writer does use the selection; and it's very important sometimes.

For instance, compare the behaviour of Writer in a string "abc", when the cursor is just after "c" without a selection, to the case when "c" is selected. In the first case, Writer would try to find the longest character sequence to the left which is a valid hex number - and find "abc", which it will convert to a Unicode character with code U+0abc; in the second case, it will only handle "c", converting it to string "U+0063".
Comment 6 Justin L 2020-07-14 12:40:23 UTC
(In reply to Mike Kaganski from comment #5)
> > (Somewhat irrelevant, since Writer doesn't use selection
> > AT ALL for toggling.)
My bad. I only meant to refer to "return toggling", not initial toggle.
Comment 7 Justin L 2020-07-14 12:46:44 UTC
One enhancement could be that Writer DOES adjust the selection to be maintained - like Draw does. I'll leave that for a Writer-oriented person to do, since that kind of stuff tends to have all sorts of complications.
Comment 8 Commit Notification 2020-07-14 13:39:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cef5a2d780ad01105dae860f6293f6f137603027

tdf#134654 sw: Alt-X - end keyboard selection too

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2020-07-14 17:19:39 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/8901f44746f3df147d327e95125cbd4a08049843

tdf#134654 sw: Alt-X - end keyboard selection too

It will be available in 7.0.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2020-07-15 08:01:12 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/a1d39b2ea097e30a4e6ea4bfb37427c712e68fe2

tdf#134654 sw: Alt-X - end keyboard selection too

It will be available in 6.4.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.