Bug 139963 - "Delete spaces and tabs at end and start of line" option in AutoCorrect needs critical evaluation
Summary: "Delete spaces and tabs at end and start of line" option in AutoCorrect need...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: AutoCorrect-Complete
  Show dependency treegraph
 
Reported: 2021-01-28 11:00 UTC by sdc.blanco
Modified: 2024-09-29 09:40 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 sdc.blanco 2021-01-28 11:00:41 UTC
According to: https://help.libreoffice.org/7.2/en-US/text/shared/01/06040100.html

  Delete blanks and tabs at end and start of lines

  Removes spaces and tabs at the beginning of each line. To use this option,
  the Apply Styles option must also be selected. 

0. Tools > AutoCorrect > AutoCorrect Options - Options tab
   uncheck all [T] and [M] options, except for following two
   [T] options.
   "Delete spaces and tabs at end and start of line"
   "Apply Styles"

1.  Make sure:  Tools > AutoCorrect > While Typing (is enabled)

2.  Use "Default Paragraph Style" or "Text Body" PS for all tests.

3.  Enter some text with spaces and/or tabs at beginning and end, press Enter

Expected result:  any spaces and tabs at beginning of line (according to "help") and at end ("according to option label") should be removed, and no change to PS.

Actual result:  converted to "Text Body Indent" but no tabs or spaces are removed (at beginning or end).


Additional information:

1. Also tested with [M]  ("Apply Styles" is not needed in this case).
Same results.

2. Afaict, this option is functionally equivalent to "Delete spaces and tabs at beginning and end of paragraph"   

3. Both options have been present since at least OOo 1.1.0, 

Critical question:  What is "intention" or "utility" or "value added" of this AC option in the bigger picture of other options? (I could not imagine anything).

Forgive my cynicism, but looks like: 

"Delete spaces and tabs at end and start of line" was a precursor to 
"Delete spaces and tabs at beginning and end of paragraph" (and did not work), 
and then someone forgot to remove the precursor, after the "paragraph" version was implemented.

Maybe this "option" should be removed?  or its true intention/value rediscovered and re-enabled.
Comment 1 sdc.blanco 2021-01-28 11:53:00 UTC
NB.  The "actual" result can also be obtained without the option being set.

Because, at present, Default is converted to Text Body automatically (with no options set) (see bug 90507), then lines with spaces or tabs will be converted to Text Body Indent anyway.

iow -- not clear that "Delete spaces and tabs at end and start of paragraph" option has any currently actual function.
Comment 2 Stéphane Guillou (stragu) 2023-05-14 22:59:26 UTC
Thanks Seth, confirmed that it is not functional in:

Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: b5a22fceed57f05eb43a5fb0817afbc141610c5e
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Same in OOo 3.3.
Comment 3 Heiko Tietze 2023-05-23 06:44:52 UTC
input =        / lorem ipsum /
beginning/end: /lorem ipsum/
end/start:     / lorem ipsum /

Michael, any idea?
Comment 4 Michael Stahl (allotropia) 2023-05-23 08:24:06 UTC
sorry, no idea
Comment 5 Heiko Tietze 2023-11-22 09:13:27 UTC
sDelSpaceAtSttEnd = RID_CUISTR_DEL_SPACES_AT_STT_END = "Delete...of paragraph" = bAFormatDelSpacesAtSttEnd

sDelSpaceBetweenLines = RID_CUISTR_DEL_SPACES_BETWEEN_LINES = "Delete...of line" = bAFormatDelSpacesBetweenLines

/// Delete beginning and/or end in a node
void SwAutoFormat::DeleteLeadingTrailingBlanks(bool bStart, bool bEnd)
{
    if( !(m_aFlags.bAFormatByInput
        ? m_aFlags.bAFormatByInpDelSpacesAtSttEnd
        : m_aFlags.bAFormatDelSpacesAtSttEnd) )
        return;
...
bAFormatByInpDelSpacesAtSttEnd // "Format/ByInput/DelSpacesAtStartEnd"
bAFormatDelSpacesAtSttEnd  // "Format/Option/DelSpacesAtStartEnd"

Last change by Michael Stahl
https://github.com/LibreOffice/core/commit/c1f1cad3e63afcf6b9bbf6e42f28efa74ec49189

void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks )
{
    if( !(m_aFlags.bAFormatByInput
        ? m_aFlags.bAFormatByInpDelSpacesBetweenLines
        : m_aFlags.bAFormatDelSpacesBetweenLines) )
        return;
...
bAFormatDelSpacesBetweenLines // "Format/Option/DelSpacesBetween",
bAFormatByInpDelSpacesBetweenLines // "Format/ByInput/DelSpacesBetween"

Last change by Takeshi Abe
https://github.com/LibreOffice/core/commit/10ffbbd269ae14677e7fced9da0268146faae919

UX-wise we should of course remove options that are not functional. And actually I wonder too what makes spaces at line start/end different from paragraph.
Comment 6 V Stuart Foote 2023-11-22 14:50:31 UTC
Also have the annoyance of spaces extending beyond margins of bug 155494 and need functional AC that effectively removes excess spaces at beginning and end of text line/paragraph.  

Formatting/styling positioning should not be done with multiples of any of the <space> characters and the AC should function like a clear formatting.