Bug 151612 - Text styles should support a "prevent line breaking" feature
Summary: Text styles should support a "prevent line breaking" feature
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Styles-Character ODF-spec
  Show dependency treegraph
 
Reported: 2022-10-17 20:38 UTC by Eyal Rozenberg
Modified: 2023-12-12 20:40 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 Eyal Rozenberg 2022-10-17 20:38:51 UTC
Sometimes you want a short stretch of text, which has some meaning as a whole (e.g. a legal case number or a multi-word title) to not be broken across lines. This is either difficult or impossible to do by Unicode control characters (non-breaking spaces are not sufficient, since you may have dashes or other non-word characters). Also, you might want to say "whenever I mark a stretch of text in some way, it should not break across lines". 

The conclusion is that this feature should be part of Character Styles. And - at the moment, it's missing. There is, in fact, no flow control settings for character styles.
Comment 1 Eyal Rozenberg 2022-10-17 20:45:14 UTC
Adding ODF-spec in case this is lacking in ODF.
Comment 2 Dieter 2022-10-31 13:18:58 UTC
As far as I understand you like to prevent certain words from hyphenation. LO still provides this option, see https://help.libreoffice.org/7.4/en-GB/text/swriter/guide/hyphen_prevent.html?&DbPAR=SHARED&System=WIN


Does this solve your problem?
=> NEEDINFO
Comment 3 Eyal Rozenberg 2022-10-31 14:56:22 UTC
This doesn't have much to do with hyphenation. I'm talking about _any_ breaks, and particularly breaks _between_ words, not the question of whether you can break within a single word or only at edges-of-words.
Comment 4 Dieter 2022-11-01 08:43:43 UTC
(In reply to Eyal Rozenberg from comment #3)
> This doesn't have much to do with hyphenation. I'm talking about _any_
> breaks, and particularly breaks _between_ words, not the question of whether
> you can break within a single word or only at edges-of-words.

You avoid line breaking between words with Strg+Shift+Space. So I really don't nderstand why a new feature is needed here.

cc: Design-Team
Comment 5 Eyal Rozenberg 2022-11-01 13:24:52 UTC
(In reply to Dieter from comment #4)
> You avoid line breaking between words with Strg+Shift+Space. So I really
> don't nderstand why a new feature is needed here.

I'm guessing you mean Ctrl+Shift+Space?

Anyway, that would be a workaround, but

1. I don't want to use formatting characters.
2. I don't want to manually handle this issue in dozens or hundreds of places where my character style is used; this is something which I should be able to enforce using the style.
Comment 6 Heiko Tietze 2022-11-07 14:03:37 UTC
(In reply to Eyal Rozenberg from comment #0)
> ...a short stretch of text

You mean Character > Position > Spacing: Character Spacing?
Comment 7 Eyal Rozenberg 2022-11-07 19:58:25 UTC
(In reply to Heiko Tietze from comment #6)
> (In reply to Eyal Rozenberg from comment #0)
> > ...a short stretch of text
> 
> You mean Character > Position > Spacing: Character Spacing?

No, I meant a short piece of text, a few words at most.
Comment 8 Heiko Tietze 2022-11-09 12:49:15 UTC
Using the CS as means to suppress paragraph break requires it to be standardized. I think it's easier to realize and more familiar to enter non-breaking spacing. Ultimately the use case is a bit far-fetched, IMO.
Comment 9 Eyal Rozenberg 2022-11-10 22:08:39 UTC
(In reply to Heiko Tietze from comment #8)
> Using the CS as means to suppress paragraph break requires it to be
> standardized.

You mean, in the ODF spec? I did mark that as a dependent. Also adding Regina to the CC list.

> I think it's easier to realize and more familiar to enter
> non-breaking spacing. 

That's a bit like saying it's more familiar to manually boldface/italicize text rather define a character style for emphasis... if you have dozens of occurrences of the CS in your document, you don't want to start typing up NBSPs. Or delete them if you've changed your mind. And you you may not want them when you export the text.

Also - many users don't even know about Ctrl+Shift+Space and NBSPs. Actually, maybe even _most_ users.


> Ultimately the use case is a bit far-fetched, IMO.

Why would you say that? Character styles for:

* Titles of books/papers
* References to legal case names (which contain hyphens, spaces etc.)

are common when writing academic documents or legal briefs. And it is not far-fetched for the user to want those not to break across lines.
Comment 10 Heiko Tietze 2022-11-14 10:06:15 UTC
(In reply to Eyal Rozenberg from comment #9)
> > Ultimately the use case is a bit far-fetched, IMO.
> 
> Why would you say that? Character styles for...

I don't buy the heavy need for such a feature. You rarely have hyphens or spaces that must not break and can easily define those as special non-breakable character offered by Unicode.
Comment 11 Eyal Rozenberg 2022-11-14 11:49:42 UTC
(In reply to Heiko Tietze from comment #10)
> I don't buy the heavy need for such a feature. 

We're talking about a feature which won't have UI on the main window, nor a toolbar button. It will only have a check-box in one of the stlye panes, e.g. in "Position", under "Spacing". So, it doesn't have to be feature with "heavy" use. In some kinds of documents, it is quite useful. And - it's a capability that's worthwhile to have in the spec.

> You rarely have hyphens or spaces that must not break

When you write legal documents, or catalogues, or engineering specs, you often want certain kinds of terms - which are likely to have a character style - to not break across lines. This is not rare.

> and can easily define those as special non-breakable character offered by Unicode.

You are suggesting using a hack instead of proper styling. If something is not local to a single place in the document, but to all occurrences of text with a certain character style, the way to handle features of that text is via the character style.

Think also of styles offered to people who are less formatting-and-styling concious: You want to offer them good defaults in the styles, minimizing the amount of design-work and consideration they need to apply.
Comment 12 Dieter 2023-11-21 08:41:32 UTC
Heiko is this a topic for a meeting of the design-team?
Eyal, could you perhaps add a sample document? And if you have that Feature, how should it work? Should font size be reduced to fit a word within a libe of spacing or ...?
Comment 13 Heiko Tietze 2023-11-22 09:45:53 UTC
(In reply to Dieter from comment #12)
> Heiko is this a topic for a meeting of the design-team?
Don't think so. It requires ODF-spec and all other document formats since this is not an option in any text processor (except simple text editors where you can switch off line wrapping - for the whole paragraph then).

We have means to prevent line breaking yet the request asks to make this easier. And I doubt this ease to be highly relevant. Eventually you end up in lines that overflow the canvas, hard to imagine this is wanted.

=> WF
Comment 14 Eyal Rozenberg 2023-11-24 21:01:12 UTC
(In reply to Dieter from comment #12)
> Eyal, could you perhaps add a sample document? 

What would you like a sample document to contain?

> And if you have that Feature, how should it work Should font size be reduced to fit a word within a line of spacing or ...?

It should work as though the whole stretch of text were a single word: Either it fits on the earlier line, or it gets placed entirely on the next line. And if it's too long - again, like the case of an overly-long word; or any other reasonable fallback.
Comment 15 Eyal Rozenberg 2023-11-24 22:59:00 UTC
(In reply to Heiko Tietze from comment #13)
> Don't think so. It requires ODF-spec

Probably, yeah.

> and all other document formats since
> this is not an option in any text processor (except simple text editors
> where you can switch off line wrapping - for the whole paragraph then).

I'm pretty sure you can do this with TeX. As for other formats - we already warn about other document formats not capturing all of ODF's capabilities; this would just be another one. (This issue might be mitigated by an export filter toggle for replace spaces with NBSP's in such text.)

Anyway, the argument about other formats and apps is essentially an argument against technical leadership in general: Don't do things which are word processors don't support. IMNSHO, that is _at most_ an argument regarding effort investment priority, not feature validity. The use case is clearly demonstrable.


> We have means to prevent line breaking yet the request asks to make this
> easier.

Not _easier_, but part of _styling_, as opposed to hack-based.

> Eventually you end up in lines that overflow the canvas

With typical uses of this feature (legal case titles, book titles, person names etc.) - you don't. Also, when we end up having decent paragraph-level algorithm (see bug 38159) - there will be even less chance of that happening.