packagecontrol.io icon indicating copy to clipboard operation
packagecontrol.io copied to clipboard

Invisible character (`​`) in package names

Open darkred opened this issue 4 years ago • 6 comments

I've noticed that there is this invisible character (​) in package names. For reference:

It's the Unicode Character 'ZERO WIDTH SPACE' (U+200B) .

this character is intended for line break control; it has no width, but its presence between two characters does not prevent increased letter spacing in justification

It occurs in words that are "combinations", e.g. SublimeLinter -> Sublime + Linter Examples pages:

  • https://packagecontrol.io/packages/SublimeLinter
  • https://packagecontrol.io/packages/BracketHighlighter
  • https://packagecontrol.io/packages/ColorHelper

Just open the 1st one, rightclick the "SublimeLinter" title and press Inspect :

screenshot

2021-03-22_184439

If you select that text in your browser and press Copy (Ctrl+C) then the copied string "Sublime​Linter" contains the hidden character: screenshot. [if you doubleclick the above string you'll notice that you can select only either 'Sublime' or 'Linter'] and that leads to getting no results when using it to search for the package in Sublime Text's Package Control manager.

e.g. I have installed SublimeLinter. If I open ST3 Preferences | Package Control | List Packages and paste the string "Sublime​Linter" (with the hidden character) I'll get no results.

Using ST3 3211 x64 on win10.

darkred avatar Mar 22 '21 16:03 darkred

This is on purpose, as it allows long package names to wrap on small screens. https://github.com/wbond/packagecontrol.io/blob/master/app/templates/helpers/word_wrap.py

wbond avatar Mar 22 '21 17:03 wbond

This pattern is used on various online docs by various organizations, since they also run into long identifiers without spaces.

wbond avatar Mar 22 '21 17:03 wbond

Thanks for replying.

I mentioned this, hoping that maybe it could be possible to remove it without breaking things. I see that's not possible, i.e. that's necessary, so I'm closing this.

PS. For anyone interested, here is a userscript that removes the hidden character from the package title:

// ==UserScript==
// @name         packagecontrol.io - remove invisible character in package name
// @match        https://packagecontrol.io/packages/*
// @grant        none
// ==/UserScript==

var re = /\u200B/g;
var packageTitle = document.querySelector('#content > h1');
packageTitle.innerHTML = packageTitle.innerHTML.replace(re, '');

darkred avatar Mar 22 '21 17:03 darkred

I haven't checked recently, perhaps there is a more modern CSS method that we can use now in 2021? This was originally added in probably 2014/2015.

wbond avatar Mar 22 '21 17:03 wbond

That would be great!

darkred avatar Mar 22 '21 17:03 darkred

Apparently, the <wbr> element should be used to suggest word break locations https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Text/Wrapping_Text#the_wbr_element.

FichteFoll avatar Mar 24 '21 01:03 FichteFoll