Bug 111842 - Strange behavior when editing measurement fields within Draw
Summary: Strange behavior when editing measurement fields within Draw
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
5.4.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-16 05:56 UTC by Kevin Holloway
Modified: 2018-08-30 08:37 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 Kevin Holloway 2017-08-16 05:56:50 UTC
Description:
When editing a measurement field (horizontal/vertical/width/height), the automatic insertion/deletion of the thousands separator causes the point of editing to move.

For example, assume a measurement field has:
1,234.00 mm
and the cursor is positioned to the left of the decimal point.  If I press backspace once (to remove the digit 4), the result is:
123.00 mm
but the cursor is now positioned to the right of the decimal point.

What is happening is:
- My backspace removes the 4, and I would expect the cursor to remain between the 3 and the decimal point.
- But, Draw is automatically removing the thousands separator.  This makes the input field one character shorter--without adjusting the position of the cursor.
- With the input field one character shorter, and the cursor in the same position it was after the removing the 4, the cursor ends up one character to the right of where it was. 

Steps to Reproduce:
1.  Enter an value in a measurement field.  The amount should be 1,234.00 mm.
2.  Position the cursor to the left of the decimal point.
3.  Press backspace once, to remove the 4 digit.


Actual Results:  
The result is 123.00 mm, but with cursor positioned to the right of the decimal point.

The cursor represents the editing position of the field, and should not move just because a character has been deleted.

It is not possible to delete multiple characters without re-positioning the cursor.

The unusual cursor movement also occurs when characters are entered, and Draw automatically inserts a thousands separator.

Expected Results:
The same result of 123.00 mm, but with the cursor positioned to the left of the decimal point (between the 3 and the decimal point).  



Reproducible: Always

User Profile Reset: No

Additional Info:
What is happening is:
- My backspace removes the 4, and I would expect the cursor to remain between the 3 and the decimal point.
- But, Draw is automatically removing the thousands separator.  This makes the input field one character shorter--without adjusting the position of the cursor.
- With the input field one character shorter, and the cursor in the same position it was after the removing the 4, the cursor ends up one character to the right of where it was. 

The unusual cursor movement also occurs when characters are entered, and Draw automatically inserts a thousands separator.


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Comment 1 Jean-Baptiste Faure 2017-08-19 19:20:47 UTC
What do you mean by "measurement field" ? Please explain step by step, mouse click by mouse click, how to reproduce the problem.

Set status to NEEDINFO, please set it back to UNCONFIRMED once requested
informations are provided.

Best regards. JBF
Comment 2 Kevin Holloway 2017-08-20 23:52:01 UTC
Step by step:

1. Open a new LibreOffice Draw document.

2. Add a rectangle.  After you have created this, make sure it is selected.

3. In the properties of the rectangle, under "Position and Size", there are four measurements: Horizontal, Vertical, Width and Height. (I have to scroll to the bottom of the properties to see these).

4.  Highlight the "Width" field and remove its contents.  (I.e., click on the "Width" field, enter ctrl-A, and then press backspace.  This will clear out the width field. The cursor will remain in the "Width" field.

5.  Press the "1" key, and wait.  The field will change to "1.00 mm" with cursor between the 1 and the decimal digit.  

6.  Press "2" and then "3".  The field will change to "123.00 mm" with the cursor between the 3 and the decimal digit.  So far, everything is correct.

7.  Press "4" and wait.  The field will change to "1,234.00 mm" but the cursor is between the 3 and 4.  I.e., "1,23|4.00" where | is the cursor.  This is not right.  The cursor should be between the 4 and the decimal point.

The problem occurs because the thousands separator (the comma) is being added, automatically, and changing the position of the cursor in the process.  The same problem occurs when a thousands separator is automatically removed.

Consider the following.  Assume I want to enter 1236, but entered 1234 by mistake.  The normal correction would be "backspace" (to remove the last entered digit, the 4) and then the correct digit, 6.  But, in Draw the following happens:

a) I enter 1234.  The width field shows "1,23|4.00 mm" (where | is the cursor).
b) Press backspace.  The 3 is removed.
c) Press 6, and the width field shows "1,26|4.00 mm".
Comment 3 Jean-Baptiste Faure 2017-08-21 05:10:22 UTC
Thank you for the detailed step by step description. Some more questions:
- How do you activate the thousand separator? Even setting the locale to English(USA) and the default language for document to English (USA), I do not have thousand separator.
- Which font is used in the user interface?
- Is there a reason to set the component to Extensions in this bug tracker instead of Draw, or is it only a typing error?

Set status to NEEDINFO, please set it back to UNCONFIRMED once requested
informations are provided.

Best regards. JBF
Comment 4 Kevin Holloway 2017-08-21 11:21:52 UTC
1.  I never "activated" the thousand separator.  It has always been there.

My locale is English(Australia), and the default language for document is also English(Australia).  Default currency is Default(USD).

I tried changing both to English(USA), restarted Draw, created a new document, and I still have the thousand separator.

2.  I am using the default font.  I have not changed this.  I am running on Windows 10.

3.  The component should be Draw.  "Extensions" was a typo.

-------------

One thing I did notice is that with a local based on USA, the unit of measure is inches (").  For Australia, the unit of measure is mm.

In addition, I am using a "Drawing scale" of 1:100.  Drawing scale is under Tools, Options, LibreOffice Draw, General.

With unit of measure of inches, and any scale, you will rarely go over 999 inches.

With unit of measure mm, and a drawing scale of 1:100, I often have measures over 999 mm (thus ending up with a thousand separator).  At a scale of 1:100, an A4 page width is 21,000mm.
Comment 5 Kevin Holloway 2017-08-25 08:38:30 UTC
More investigation.  In brief, the page size input fields act differently to the shape measurement input fields.

Step by step:

I start LibreOffice and create a new Draw document.  My locale is English(Australia) so my measurements are mm.

I set the drawing scale to 1:1.

I then go to Format, Page Properties).  The popup dialog box is called "Page Setup".  In this dialog box I change the paper size to A0 (the largest paper in the A-series).  When I do this, the page height is shown as 1,189.00 mm.  Note the thousands separator.

I then highlight the 1,189 mm, delete it, and then enter a new page height of (say) 1234 mm.  No thousands separator is added UNTIL focus is lost on the page height entry field.

I then create a rectangle, dragging the corners until it occupies most of the page.  If I look at the rectangle properties, under "Position and Size", the height (in my case) is 1,222 mm.  

If I highlight the 1,222 mm, delete it, and then enter a new shape height of (say) 1122mm.  In this case the thousands separator is added as the characters are entered.  I end up with 1,22|2.00 mm, where | is the position of the cursor.

A more consistent and usable approach would to have the shape measurements (height, width, horizontal and vertical) act the same way as the paper size measurements.  That is, to format the field (add the thousands separator and decimal digits) when focus is lost, rather than as the characters are entered.
Comment 6 Jean-Baptiste Faure 2017-08-27 15:09:03 UTC
Ok, reproducible in French. Thank you for the bug report.

My steps to reproduce:
1/ open a new Draw document
2/ setup Draw to use mm as unit : tools > Options > LibreOffice Draw > General -> unit of measurement
3 setup Draw to use the sidebar
4/ set the page size to A0 landscape in order to have page width > 1000 mm
5/ draw a rectangle almost as large as the page -> you can see its width in the sidebar, something like 1 159,00 mm
6/ click in this field in the sidebar, then ctrl+A and backspace to erase its content, then start to typing : 1, 2, 3, until then nothing remarkable, then type 4 : the thousand separator is inserted just after the 1 and the cursor becomes positioned after the 3 instead of the 4. So if you continue typing, you insert characters between the 3 and 4 instead of after the 4. That is the bug.
7/ now move the cursor just after the 4, between the 4 and the decimal separator and press backspace the remove the 4 -> the thousand separator is removed but the cursor is positioned after the decimal separator. That is the other manifestation of the bug. 

As said in comment #5 we do not see this behavior in the page format dialog if you change the page width (you can go up to 3000 mm).

Setting as NEW.

Best regards. JBF
Comment 7 QA Administrators 2018-08-28 02:42:49 UTC Comment hidden (obsolete)
Comment 8 Kevin Holloway 2018-08-30 08:37:12 UTC
What happens now is that the 1000s separator (comma in the English locale) is not added automatically.  If you enter 1234, the 1000s separator is only added when focus is lost.  This is now the same as the page format dialog (as per comment #5) which is good.

Version: 6.1.0.3 (x64)
Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: en-AU (en_AU); Calc: group threaded