https://bugs.documentfoundation.org/show_bug.cgi?id=172899

            Bug ID: 172899
           Summary: Problems with the display of soft (conditional)
                    hyphens in LibreOffice Writer
           Product: LibreOffice
           Version: 26.2.4.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Legibility/​Usability Improvement: Changes to display of inactive/​embedded
soft/​conditional hyphens

Technically, what follows could be considered two separate issues involving how
soft hyphens are displayed in body text, for one, and how soft hyphens are NOT
displayed in Find and Replace field, for the other. But seeing as how fixing
them might involve some of the same kind of work, I'm submitting them as one
bug for now. The first is an annoyance; the second more seriously impacts
usability.

BACKGROUND

When typists want to enable hyphenation of words that LibreOffice Writer would
otherwise not know how to hyphenate, they can insert soft/​conditional hyphens
by typing Ctrl+- (Ctrl+hyphen) at the desired hyphenation break points. In my
experience, this is called for most often with long proper nouns, borrowed
foreign words, and neologisms (new words) that don't follow the active
language's standard hyphenation rules.

BODY TEXT

Currently, soft hyphens are properly displayed in body text when they appear at
the end of the line, like normal breaking hard hyphens and hyphens generated by
automatic hyphenation. When the word is in the middle of a line and the soft
hyphens are *inactive* ("embedded" and non-printing), however, they appear
superimposed on the character following the hyphenation break point, in the
same color as the rest of the word. This makes for unpleasant, distracting
reading onscreen.

My suggested fix is that inactive soft hyphens not be displayed at all when
"Toggle Formatting Marks" (Ctrl-F10) is OFF and that they only be displayed
when "Toggle Formatting Marks" is ON, SUPERIMPOSED as at present BUT IN TICINO
BLUE, like other nonprinting characters. That change would: (1) follow the
logic of "Toggle Formatting Marks," i.e., of hiding and unhiding non-printing
characters; (2) allow accurate proofreading, editing, and formatting to the
same extent as before when the display of non-printing characters is toggled
ON; and (3) make for more pleasant, less distracting, more WYSIWYG onscreen
reading when the display of non-printing characters is toggled OFF.

FIND AND REPLACE DIALOG

Soft/​conditional hyphens are NOT DISPLAYED AT ALL, EVER, in Writer's Find and
Replace dialog, in either the Find field or the Replace field. Soft hyphens ARE
embedded in text that is *copied-and-pasted* into those fields (or picked up
automatically in the Find field by virtue of being selected when the Find &
Replace command is invoked), but they are COMPLETELY INVISIBLE.

Additionally, you CANNOT MANUALLY TYPE A SOFT HYPHEN into Find and Replace
fields.

If you left-arrow from the end of a copied-and-pasted (or automatically
picked-up) string containing one or more soft hyphens, you will move the cursor
left normally, one character per cursor command, up to the character following
the invisible hyphenation break point. Once you reach that point, the NEXT
left-arrow command WON'T MOVE THE CURSOR AT ALL because it has backed up over
the invisible soft hyphen. (You can delete the soft hyphen at this point, and,
as explained in the following paragraph, you MUST delete all soft hyphens in
the Find string if you want the Find commands to find ANYTHING.) After that,
the left-arrow command will resume moving the cursor normally (until it hits
the PREVIOUS soft hyphenation break, if there is one). The same is of course
true, mutatis mutandis, right-arrowing from the beginning of the word, and of
course the Backspace key works as well as the Delete key for deleting invisible
soft hyphens, so long the cursor is at the correct position "behind the scene."
If you end up deleting a visible character, you weren't in the right position.

Find and Replace will NOT find any matching targets when the text in the Find
field contains invisible embedded soft hyphens. You have to STRIP OUT (DELETE)
ALL SOFT HYPHENS FROM FIND FIELD TEXT in order to find ANY "matching" text in
the document body. Text containing soft hyphens in the REPLACE field GETS
PASTED INTO THE DOCUMENT BODY WITH ITS SOFT HYPHENS INTACT when the Replace or
Replace All commands are invoked. (In short, you have to strip soft hyphens out
of Find text and leave them in Replace text.) 

This is very clumsy and user-unfriendly. Instead, I propose that soft hyphens
(and other non-printing characters?) be displayed in standard non-printing
Ticino blue in the Find-and-Replace dialog fields. (Superimposing the hyphens
on the character following the hyphenation break, as suggested for body text,
would be ideal.) As a markedly less WYSIWYG alternative, note that open-source
Windows text editor Notepad++ offers the option of displaying non-printing and
control characters onscreen (via the View > Show Symbol menu). These characters
are displayed using reverse-color, uppercase codes, like SHY for soft hyphen,
ZWSP for zero-width space, THSP for thin space, and NNBSP for narrow
non-breaking space. It's an ugly, distracting solution when the text you're
working on contains a lot of non-printing and control characters, but
functionally, it's MUCH better than having to fish around blindly for invisible
characters as is currently the case in Writer's Find and Replace fields.

NB: I'm a frequent user of the Alternative Find & Replace (AltSearch) extension
— when I can figure out HOW to use it for the task at hand! — and it has the
same soft-hyphen problems as the standard Find & Replace dialog.

Steps to Reproduce:
1. In a new Writer document set up with justified paragraphs and automatic
hyphenation on, type a sequence of one or two medium-to-long words that Writer
probably won't know how to correctly hyphenate, then copy-and-paste it
(including a trailing space) so as to fill up multiple lines in the new
paragraph. The fantasy character name Rhaenys Targaryen from Game of Thrones
should work, but choose any words (fantasy, proper, foreign, brand-new) that
are not in one of your active spelling dictionaries, that you know how to
pronounce, and that LibreOffice will probably not know how to hyphenate (either
not hyphenating it at all or hyphenating it wrong).

2. Select the sequence of "unhyphenatable" words you initially typed in (not
the entire paragraph) and invoke the Find and Replace command (Ctrl+h). The
Find and Replace dialog window pops up with the selected text pre-loaded into
the Find field.

3. Leave the Find and Replace window open and return focus to the document
body. Insert soft hyphens into the words you initially typed by cursoring to
the points at which you think their correct pronunciation dictates hyphenation
breaks and then typing Ctrl+- (Ctrl+hyphen). (Knowing how Rhaenys Targaryen is
supposed to be pronounced, I would hyphenate it Rhae-nys Tar-gary-en.) Note the
appearance of the text you just soft-hyphenated, with the display of
non-printing characters toggled both on and off (Ctrl+F10). Then reselect the
sequence of words you just soft-hyphenated and copy it (Ctrl+c). Then click at
the very beginning of the paragraph so that nothing is selected.

4. Switch focus back to the Find and Replace window and paste the text you just
copied into the Replace field. Then choose Replace All and examine the
appearance of the text in the entire paragraph, again with the display of
non-printing characters toggled both on and off (Ctrl+F10). If necessary,
change the paragraph indents or the font size so that you force at least some
of the soft-hyphenated words to break at the end of a line. Then close the Find
and Replace window.

5. Reselect the text sequence you previously copied-and-pasted and invoke the
Find and Replace dialog again (Ctrl-h). The text you selected will
automatically be preloaded into the Find field like the first time, but this
time with invisible soft hyphens embedded in it. Then click the Find Next
command and note the result.

6. Remaining in the Find and Replace window, delete the invisible soft hyphens
from the Find string by left-arrowing your way from the end, one character at a
time. When the cursor doesn't move, it's because you've backed up over an
invisible soft hyphen, which you can delete by typing the Delete key. Continue
locating and deleting any remaining soft hyphens that way until the cursor is
at the beginning of the string. NOW try hitting the Find Next button and note
the results.

Actual Results:
In the document body, soft hyphens are displayed properly when they mark an
active hyphenation break at the end of a line, but when they are inactive (and
"embedded" and non-printing), they are always displayed superimposed over the
following character and in the font's normal color, regardless of whether the
display of non-printing characters ("formatting marks") is turned on or off
with Ctrl+F10.

In the Find and Replace dialog fields, soft hyphens aren't displayed at all
(when embedded, they are invisible) and they can only be located and deleted by
cursoring through the string one character at a time.

Find commands cannot find anything when the Find string contains embedded soft
hyphens. All soft hyphens must be stripped out of text in the Find field for
the Find commands to work.

Expected Results:
In the document body, I would expect inactive ("embedded," non-printing) soft
hyphens in words that aren't broken over two lines to be displayed in Ticino
blue (like other non-printing characters) when the display of "formatting
marks" is toggled ON (with Ctrl+F10), and I would expect them not to be
displayed at all when the display of "formatting marks" is toggled OFF (again,
with Ctrl+F10). The current display of "activated" soft hyphens, at the end of
a line, is fine.

I would expect soft hyphens to be displayed SOMEHOW in the Find and Replace
dialog fields, ideally with superimposed hyphens in Ticino blue, as proposed
for the document body.

I would expect Find strings that contain embedded soft hyphens to find matching
strings in the document body.

If Find strings MUST for now continue to be free of any embedded soft hyphens
for Find commands to work at all, I would expect the Find and Replace dialog to
automatically strip all soft hyphens out of the Find string, whether the Find
field was automatically populated by body text that was selected when the Find
and Replace dialog was invoked, or manually populated by text copied-and-pasted
by the user.


Reproducible: Always


User Profile Reset: No

Additional Info:
My profile is working just fine! Another user reported a similar/​related kind
of Find and Replace bug/​limitation involving non-breaking spaces, so I'm
pretty confident that's a coding issue, not a profile issue. Also, I tested the
document-body display of soft hyphens with not just my usual Linux Libertine G
font, but with bog-standard Times New Roman as well, so it's pretty unlikely to
be a Graphite problem.

Many thanks to any bug-fixers who take the time to look into this report, and
especially to those who try to tackle any of it. I have a non-coder's hunch
that the document-body display issue might not be *too* horribly difficult to
fix but that the Find-and-Replace problems might be a bigger can of worms,
potentially involving code that hasn't been significantly overhauled since the
days of StarOffice.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to