VisualEditor: Ctrl+Space/Opt+Space to insert a non-breaking space (NBSP)
Open, LowPublic1 Story Points

Description

Editor requests support for adding non-breaking spaces ( ), keyboard shortcut?

From MediaWiki Feedback:

How do I enter a no-break space (& nbsp;) into the source text via the keyboard? Something like Ctrl+Space would be nice … And, BTW, can I see the difference between a regular space and a no-break space?

Troubled @sset Work • Talk • Mail‎18:03, 8 July 2013


Alternative: T70429: VisualEditor: Add non-breaking space (nbsp) to the "special character" dialog

Details

Reference
bz51045
bzimport raised the priority of this task from to High.
bzimport set Reference to bz51045.
Elitre added a subscriber: Elitre.Jan 5 2015, 5:22 PM
Jdforrester-WMF lowered the priority of this task from High to Low.Jan 15 2015, 12:31 AM
Jdforrester-WMF set Security to None.
Gnom1 added a subscriber: Gnom1.Mar 9 2015, 1:35 PM
Aklapper renamed this task from VisualEditor: Ctrl-Space to insert an NBSP, and a way to see the difference to VisualEditor: Ctrl-Space to insert a non-breaking space (NBSP), and a way to see the difference.Mar 19 2015, 11:09 AM
Nnemo added a subscriber: Nnemo.Apr 23 2015, 4:23 PM

For this feature, I suggest Ctrl Shift Space rather than Ctrl Space.

Reasons :

  1. Ctrl Space is already taken for Spotlight on Mac.
  2. The Word feature for entering a non-breaking space is pressing Ctrl Shift Space.

The Word feature is quite well known. Having an inconsistency here would confuse users.

Nnemo added a comment.Apr 23 2015, 4:37 PM

For this feature, something would need to be clarified :

What would the keyboard combination insert in the wikicode ?

  1. The character non-breaking space
  2. The HTML entity  

These are two different things.

For this feature, I would recommend inserting the character non-breaking space. Inserting the non-breaking space character leaves the wikicode natural and readable. Well, as readable as the wikicode already is. ;-)

Ltrlg added a comment.EditedApr 23 2015, 10:17 PM

Inserting only the character is not persistent: there is at least one browser which replaces non-breaking spaces with normal spaces in <textearea>s (may be Firefox? don’t remember). See this diff for an example of such a replacement (I read unfortunately more talk pages than articles and don’t remember an recent example in ns-0).

Of course there are safe places (before colons, inside French quotations marks) where MediaWiki does not require a special space to render a non-breaking one and where it would make no difference.

Inserting only the character is not persistent: there is at least one browser which replaces non-breaking spaces with normal spaces in <textearea>s (may be Firefox? don’t remember). See this diff for an example of such a replacement (I read unfortunately more talk pages than articles and don’t remember an recent example in ns-0).

Sometimes, a replacement of non-breaking spaces with normal spaces in the text area occurs (occurred). This is (was) caused by a bug of Firefox, that was fixed years ago. Now, this happens rarely, because people having a fossil Firefox are rare. Over time, such replacements will be rarer and rarer.

Of course there are safe places (before colons, inside French quotations marks) where MediaWiki does not require a special space to render a non-breaking one and where it would make no difference.

These safe places exist. But :

  1. I think that these safe places are a setup specific to the site fr.wikipedia.org, and do not apply in the general case of a MediaWiki. I may be wrong here.
  2. These safe places do not work in links.
  3. These safe places do not work in wikicode.
  4. « The safe places for french quotes » do not work in the visual editor — this is a bug, by the way.

Or you could somehow annotate the whole word as nowrap. Arguably <nowrap>100 °C</nowrap> would be clearer than 100&nbsp;°C

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 27 2015, 1:51 PM

Change 255937 had a related patch set uploaded (by Bartosz Dziewoński):
Add command to insert non-breaking space, triggered by Ctrl Space (PC) / Opt Space (Mac)

https://gerrit.wikimedia.org/r/255937

matmarex renamed this task from VisualEditor: Ctrl-Space to insert a non-breaking space (NBSP), and a way to see the difference to VisualEditor: Ctrl+Space/Opt+Space to insert a non-breaking space (NBSP).Nov 29 2015, 6:18 PM

I also think CTRL+space is quite a high profile shortcut to assign to a relatively uncommon feature.

Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from Backlog to TR3: Language support on the VisualEditor board.

Change 255937 abandoned by Bartosz Dziewoński:
Add command to insert non-breaking space, triggered by Ctrl Space (PC) / Opt Space (Mac)

Reason:
This doesn't seem to be moving forward. And last time I checked, non-breaking spaces in VE-MW (implemented as MWEntity) had a bunch of problems like T119838, T119839, T119840; so we wouldn't really want to point users towards them without fixing that first.

https://gerrit.wikimedia.org/r/255937

If those are blockers, can they be listed as such?

Nnemo added a comment.Jan 21 2016, 8:13 PM

Change 255937 had a related patch set uploaded (by Bartosz Dziewoński):
Add command to insert non-breaking space, triggered by Ctrl Space (PC) / Opt Space (Mac)

https://gerrit.wikimedia.org/r/255937

Option Space on Mac is a good combination. Regarding Ctrl Space on PC, would Ctrl Shift Space work as well? It would be good.

Regarding Ctrl Space on PC, would Ctrl Shift Space work as well? It would be good.

Yes, that patch actually used both of these combinations, but space in the commit summary is limited ;)

matmarex removed matmarex as the assignee of this task.Feb 29 2016, 7:14 PM
matmarex removed a project: Patch-For-Review.
matmarex added a subscriber: matmarex.
Krinkle removed a subscriber: Krinkle.Mar 8 2016, 10:17 PM
Cirdan added a subscriber: Cirdan.
Wdwd added a subscriber: Wdwd.Mar 12 2016, 7:56 PM