Avoid breaking on wrong side of brackets
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Per https://github.com/mapbox/mapbox-gl-js/pull/3743#issuecomment-266897015, we should weight all left and right brackets, not only ASCII parentheses, to avoid breaking on the wrong side of them. A comprehensive list of such brackets can be found by querying the Unicode Character Database for the following properties:
* `Ps` (Punctuation, open)
* `Pe` (Punctuation, close)
* `Pi` (Punctuation, initial quote)
* `Pf` (Punctuation, final quote)
[This table](http://www.unicode.org/Public/UCD/latest/ucd/PropList.txt) may be a good starting point.
Of interest to major Western languages are the following brackets:
```
()[]{}<>«»‹›
```
These quotation marks may be problematic because they bind on different sides depending on the language. I think we should penalize them only when surrounded by ideographic characters:
```
“”‘’„
```
Of interest to CJK are the above, plus:
```
(){}〔〕〘〙【】《》〈〉〖〗<>[]⦅⦆「」『』「」
```
/ref #3505
/cc @ChrisLoer @nickidlugash
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the discussion in PR #3743 and the related reference to issue #3505, then consult Unicode's PropList.txt for Ps, Pe, Pi, and Pf characters. The work is done when line breaking weights the relevant bracket characters correctly, including the listed Western and CJK cases, while quotation marks behave appropriately around ideographic characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- internationalization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100