Bug 122676 - FORMATTING Currency Negative Values does not Correctly Apply (*) with a Space
Summary: FORMATTING Currency Negative Values does not Correctly Apply (*) with a Space
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.4.2 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Czeber László Ádám (NISZ)
URL:
Whiteboard: target:24.2.0 target:7.6.0.0.beta2 ta...
Keywords:
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
 
Reported: 2019-01-12 17:36 UTC by Joe
Modified: 2023-06-29 08:54 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample Calc document (8.28 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-01-12 17:36 UTC, Joe
Details
Screenshot of the sample document (2.41 KB, image/png)
2019-01-12 17:39 UTC, Joe
Details
how it looks for me in master (2.64 KB, image/png)
2019-03-21 16:12 UTC, Xisco Faulí
Details
printscreen Czech locale (130.39 KB, image/png)
2019-03-25 18:10 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe 2019-01-12 17:36:51 UTC
Created attachment 148268 [details]
Sample Calc document

When using a currency format with asterisk (*) and space, the formatting is wrong when the result contains a space as a thousand separator. Please see attached document (the Format was created by LO when converting from XLS document). The idea is that the "minus" sign should be aligned to the left for all cells, where the numbers remains right-aligned.
Comment 1 Joe 2019-01-12 17:39:21 UTC
Created attachment 148269 [details]
Screenshot of the sample document

As the issue is supposedly locale dependent, I have also made a screenshot of the sample document as it appears in Czech locale (space as a thousand separator).
Comment 2 Xisco Faulí 2019-03-21 16:12:34 UTC
Created attachment 150152 [details]
how it looks for me in master
Comment 3 Xisco Faulí 2019-03-21 16:14:14 UTC
Same result in

Versión: 6.2.2.1
Id. de compilación: fcd633fb1bf21b0a99c9acb3ad6e526437947b01
Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: threaded

with spanish locale.

@Raal, do you reproduce it in czech locale ?
Comment 4 raal 2019-03-25 18:10:17 UTC
Created attachment 150279 [details]
printscreen Czech locale

printsreen from In Version: 6.3.0.0.alpha0+
Build ID: 82463bdde75447d45e0cd6ed9ab579e0e51ea912
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: cs-CZ (cs_CZ.UTF-8); UI-Language: en-US
Calc: threaded
and Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)

in both versions is space as thousand separator. 
Format code in 4.1 copied from format cell dialog: 
[>0]# ##0" € ";[<0]# ##0" € ";-#" € ";@ 
Format code in 6.3:
[>0]" "* # ##0" € ";[<0]-* # ##0" € ";" "* -#" € ";" "@" "
Comment 5 Buovjaga 2019-07-14 16:57:55 UTC
NEW per Raal's result.
Comment 6 QA Administrators 2021-07-14 03:34:17 UTC Comment hidden (obsolete)
Comment 7 Joe 2021-08-01 17:02:35 UTC
Hello, 
I have retested this bug with the current LibreOffice 7.1.5.2 and the upcoming LibreOffice 7.2.0.2 (on Windows 10 x64 with Czech locale). The behavior remains the same: The "minus" sign is still not aligned properly if the number contains a space as a thousand separator (e.g. in Czech locale).

I have also checked how older versions behave (on Windows 7 x86 with Czech locale):
* with versions 3.3.0.4, 4.0.0.3 and up to 4.3.7.2 the "minus" sign is not shown at all (displaying the negative numbers incorrectly).
* with versions 4.4.0.3 and newer, the display behaves just like the current releases (number shown correctly, just the alignment of the "minus" sign is wrong).
Comment 8 László Németh 2023-06-20 12:42:41 UTC
Note: there is a better solution for the layout problem: using narrow no-break space (U-202F), which doesn't enable the different layout, and this is the proposed thousand separator in typography.
Comment 9 Commit Notification 2023-06-20 12:45:48 UTC
Czeber László Ádám committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/72e70088dc45fbe15f809abf5263247b13d937ac

tdf#122676 sc: fix format with * (filling) and NBSP thousand separator

It will be available in 24.2.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 10 László Németh 2023-06-20 12:48:05 UTC
@Joe and all: thanks for the report and feedback!

@László: thanks for the nice fix!

Commit description:

tdf#122676 sc: fix format with * (filling) and NBSP thousand separator

Numbers containing no-break space (NBSP) thousand separator enabled
the EditEngine layout, losing filling e.g. for stretching spaces.
Enable EditEngine for NBSP characters only if there is no filling
in the number format code, fixing MSO interoperability, too.

In number format codes, asterisk (*) followed by a character is used
to fill the available space in the column with that character, e.g.
format code

[>0]" "* # ##0" € ";[<0]-* # ##0" € ";" "* -#" € ";" "@" "

put the minus sign at the left side of the column, while
the number at the right side of the column. Because of the NBSP
thousand separator, bigger numbers got different layout previously,
i.e. minus signs right next to the numbers.

Note: there is a better solution for the layout problem: using narrow
no-break space (U-202F), which is the proposed thousand separator in
typography, and it's back-compatible, because it doesn't enable the different layout.
Comment 11 Commit Notification 2023-06-23 08:24:48 UTC
Czeber László Ádám committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/68bbbfd3b93c546c8004e916ea58a4c16f95c648

tdf#122676 sc: fix format with * (filling) and NBSP thousand separator

It will be available in 7.6.0.0.beta2.

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 12 NISZ LibreOffice Team 2023-06-23 08:41:32 UTC
Verified in:
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 986c2d86a7b53a6599d014db7327f47cb33d4fea
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL threaded
Comment 13 Commit Notification 2023-06-29 08:54:27 UTC
Czeber László Ádám committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/56c965372e2de4ea53b1ab09056906c85fbff06b

tdf#122676 sc: fix format with * (filling) and NBSP thousand separator

It will be available in 7.5.5.

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.