Bug 114773 - TOC: Remove additional space after chapter number in ToC
Summary: TOC: Remove additional space after chapter number in ToC
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.1.2 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.6.0 target:7.5.2
Keywords: bibisected, bisected, regression
: 115060 145473 (view as bug list)
Depends on:
Blocks: TableofContents-Indexes Heading-Numbering
  Show dependency treegraph
 
Reported: 2017-12-30 20:44 UTC by Thomas Lendo
Modified: 2023-03-11 18:38 UTC (History)
15 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 Thomas Lendo 2017-12-30 20:44:29 UTC
See attachment 132787 [details].

In 5.3.1 an additional space after the chapter number in a Table of Content was introduced. You can test it with attachment 132787 [details] of bug 44282.

Illustration and table indexes are not affected.
5.3.0 wasn't affected. 5.3.2 and later versions are also affected.

Steps to reproduce:
1. Open the mentioned Writer file.
2. Update the table of indexes.

Actual result:
2.1 Heading level 2 ................. 2 -1

Expected result:
2.1 Heading level 2 ................. 2-1
Comment 1 Dieter 2017-12-31 12:01:43 UTC
I confirm it with

Version: 6.0.0.1 (x64)
Build ID: d2bec56d7865f05a1003dc88449f2b0fdd85309a
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
Locale: de-DE (de_DE); Calc: CL


The difference between TOC and illustration and table index is, that the entry is different:
TOC: Chapter No.
Table index: Chapter Info
Comment 2 Cor Nouws 2018-01-03 16:54:56 UTC Comment hidden (obsolete)
Comment 3 Thomas Lendo 2018-01-03 21:21:02 UTC Comment hidden (obsolete)
Comment 4 Thomas Lendo 2018-01-18 20:03:14 UTC
*** Bug 115060 has been marked as a duplicate of this bug. ***
Comment 5 raal 2018-01-22 11:46:50 UTC
bbisect 5f1ebf0563dfa376c8ff949fce15616c8a29f41f is the first bad commit
commit 5f1ebf0563dfa376c8ff949fce15616c8a29f41f
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Wed Feb 15 17:20:50 2017 -0800

    source dc8ebf205c3231ffc4d6737b53cee396c2ac0bfd

    source dc8ebf205c3231ffc4d6737b53cee396c2ac0bfd
	
author	Xisco Fauli <anistenis@gmail.com>	2017-02-15 11:06:00 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-02-15 11:33:56 +0000
commit dc8ebf205c3231ffc4d6737b53cee396c2ac0bfd (patch)
tree 10fb4e9a4d6bb474f4dd0144354df612d33ba38c
parent 54c0b9977a6421ecb7383fa48636075c6ca9967e (diff)
tdf#104315: Revert "tdf#44282 fix missing space...
... for numbered lists in TOC"

This commit is causing lot of regressions in TOC.
Besides, as the comment says, it's an ugly hack,
so I'd prefer to revert it and find a better solution
Comment 6 Xisco Faulí 2018-01-22 12:13:06 UTC
The bisection in comment 5 is not correct, as the commit mentioned only reverts a previous commit.

Regression introduced by:

author	Abhilash Singh <abhilash300singh@gmail.com>	2016-07-22 11:48:45 +0530
committer	jan iversen <jani@documentfoundation.org>	2016-08-16 06:26:04 +0000
commit ce95e39f8e952159844e9dc04a1df402bb103634 (patch)
tree dc419e5a1cb976ceab9867bd0b20612c8f8cf199
parent 989e8bc0d792f0dc5778746fac45de129a22d7ac (diff)
tdf#44282 fix missing space for numbered lists in TOC

Bisected with: Abhilash Singh

Adding Cc: to bibisect-linux-64-5.3
Comment 7 Yvan Rose 2018-02-17 15:03:24 UTC Comment hidden (no-value)
Comment 8 Yvan Rose 2018-04-09 13:58:40 UTC Comment hidden (no-value)
Comment 9 Timur 2018-07-31 09:17:46 UTC
Additional space is ugly. 
I think proper solution is tab stop in Bug 32360.

Actual result (space is tied to chapter number):
2.1(space)Heading level 2 ................. 2(space)-1
Expected result (tab is entry in ToC structure):
2.1(tab)Heading level 2 ................. 2-1
Comment 10 Yvan Rose 2018-09-04 22:52:17 UTC Comment hidden (obsolete)
Comment 11 Cor Nouws 2018-09-07 15:55:49 UTC Comment hidden (obsolete)
Comment 12 Yvan Rose 2018-09-07 16:22:10 UTC
(In reply to Cor Nouws from comment #11)
> @thomas: as far as I see, the space only is added after the second chapter
> number in the line, and only added once, not repeatedly?
> So update summary of this issue?

The extra space always appears between the automatic number generated by Writer (as set by list or outline/chapter numbering) and the author-entered contents that follows. So if you have the punctuation input automatically by Writer, the extra space appears after that punctuation (e.g. "2.  blahblah" > note that there are two spaces before blahblah); if you have the punctuation entered by the document's author, then the extra space appears before that punctuation (e.g. "2 . blahblah").

Does this clarify the issue?
Comment 13 Thomas Lendo 2018-09-07 17:37:28 UTC
(In reply to Cor Nouws from comment #11)
> @thomas: as far as I see, the space only is added after the second chapter
> number in the line, and only added once, not repeatedly?
> So update summary of this issue?
For, I see this extra space in every TOC line, not only once and not only after the second chapter. Therefore the summary is still valid.
Comment 14 Yvan Rose 2019-01-13 14:12:12 UTC Comment hidden (no-value)
Comment 15 Yvan Rose 2019-04-04 12:08:16 UTC
I just did some check with LO 6.2.2.2. The same problem is there.
Comment 16 Julius Becker 2019-04-27 14:38:09 UTC
In LO 6.2.3.2, this "bug" persists.

I do understand why the space after chapter number (E#) is default, but it should be possible to remove it. My document has three parts and every part has it's own paging. Due to the default space, it looks (A -1, A -2, ..., B -1, B -2, ..., C -1, C -2) not the way I want it to look (A-1, A-2, ..., B-1, B-2, ..., C-1, C-2).
Comment 17 Cor Nouws 2019-04-27 18:57:15 UTC Comment hidden (obsolete)
Comment 18 Cor Nouws 2019-04-27 19:24:43 UTC
Patch introducing the problem is this one
  https://cgit.freedesktop.org/libreoffice/core/commit/?id=ce95e39f8e952159844e9dc04a1df402bb103634

Note: before that patch, there was no space between the chapter number and the chapter text. Which is annoying and much more prevalent than the example of this bug. It was a problem in OOo already (and is in AOO)
See bug 44282

File with the code is here
  https://opengrok.libreoffice.org/xref/core/sw/source/core/tox/ToxTextGenerator.cxx?r=80cedb5d
Comment 19 Yvan Rose 2019-04-27 22:24:34 UTC Comment hidden (no-value)
Comment 20 Yvan Rose 2019-09-28 11:44:03 UTC Comment hidden (no-value)
Comment 21 Yvan Rose 2020-07-28 17:30:56 UTC Comment hidden (no-value)
Comment 22 phv 2021-12-23 14:38:33 UTC
*** Bug 145473 has been marked as a duplicate of this bug. ***
Comment 23 phv 2021-12-23 15:11:54 UTC
I therefore summarize the comments which converge in the same direction:
- The systematic addition of a space before the chapter number (E#) in the table of content (TOC) is criticized because this character disrupts entries list.
- It's a regression from a patch whose developer has not considered all potential downsides (#44282).
- Solutions exist such as consistently adding a tab (#32360) or a space that can be removed, before the chapter number and for all levels, in the Structure and Formatting tab.

It would be interesting to have the opinion of the team in charge of user interface on this matter.

Thank you!
Comment 24 ajlittoz 2022-06-29 10:17:27 UTC
Putting this space into one of the text entry boxes of the Structure line would allow user control over this insertion.

Everything which imposes a convention on user should be avoided. This is the case for this automatic space which can't be eliminated (I have cases where I end up with two spaces (one from the numbering style and the automatically added spece).
Comment 25 Mike Kaganski 2023-02-28 18:40:55 UTC
https://gerrit.libreoffice.org/c/core/+/147997

The implemented solution is:
Keep the hack introduced in tdf#44282, but only add the space if the next token is "entry text", and also if the entry number does not end with a space or a tab.

This allows the following situations:

1. The problem from bug 44282 - the existing ToCs without any space token between the number and the text will keep working as desired, with the space added automatically.
2. The problem from comment 0 (attachment 132787 [details]) had two problematic places:
2.1. There were two space characters inserted between [E#] and [E]. After updating, the ToC had three spaces between those elements.
2.2. There was a [E#]-[#] sequence. After updating, it was shown as 2 -1.
Both problems get fixed, because in both cases, since the next element after [E#] is not [E], but a text (either two spaces, or a dash), the automatic space will not be added.
3. Comment 9 suggests a tab between [E#] and [E]. It is possible now, and again, since the next after [E#] will be [T], not [E], the automatic space will not appear. Whether it should become a default or not is a different thing, a topic for UX; I would think it's questionable, but technically no problem anymore.
4. Comment 24 also mentioned possible spaces as a postfix of the number itself, which would result in a double space. Since the change checks the last character of the number, this will also prevent the extra space.

Wrt #3, I think that an alternative solution (mentioned in comment 23) - i.e., having the *space* explicitly between [E#] and [E] by default - is not optimal, because visually, the empty text placeholder between those elements is indistinguishable form the placeholder with a space character.

All in all, I hope that this will be clever enough to avoid 99.9% of possible problems; I consider a wish to really have the number merged to the following entry text (which is impossible in the current and new situation) to be ~improbable to consider.
Comment 26 Mike Kaganski 2023-02-28 18:48:09 UTC
(In reply to Mike Kaganski from comment #25)
> I consider a wish to really have the number merged to the
> following entry text (which is impossible in the current and new situation)
> to be ~improbable to consider.

On the second thought, having a WJ there between [E#] and [E] would allow even that.
Comment 27 Commit Notification 2023-02-28 19:12:49 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#114773: only add space between entry number and text

It will be available in 7.6.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 28 Commit Notification 2023-03-01 10:33:27 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/5e6597d4a0b5035df080830733697c46343f3fbb

tdf#114773: only add space between entry number and text

It will be available in 7.5.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 29 sdc.blanco 2023-03-02 07:37:29 UTC
(In reply to Mike Kaganski from comment #25)
> All in all, I hope that this will be clever enough to avoid 99.9% of
> possible problems.
At least for my simple test case with the [E#]-[#] sequence (and using Levels 1-3), the extra space after E# is gone!  Thanks for fixing this Mike!
Comment 30 Dieter 2023-03-05 12:13:30 UTC
Verified with attachment 132787 [details] from original bug report and

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d7c609dbb1bd08865b43719d2fb7c316d30bcde5
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-GB
Calc: CL threaded

Mike, thank you for fixing it!
Comment 31 Commit Notification 2023-03-07 21:54:50 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#114773: sw_uiwriter3: Add unittest

It will be available in 7.6.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 32 Lee 2023-03-11 18:38:14 UTC
Using build https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=ee5dbd193fa24b46fb980ddd8a6c39ca349d0d01 (I'm using the Unix version [deb])

The TOC no longer has that extra space.  

Thanks for fixing this.