Firacode: Ligature request: \( and \)

Created on 6 Jan 2018  Â·  2Comments  Â·  Source: tonsky/FiraCode

Backslashes are used in basic regular expressions to denote special meaning. I think it would be much easier to read if the backslashed characters were ligatures.

Mockup using U+0952 or U+0332:

image

Ligatures to consider:

  • \(
  • \)
  • \+
  • \*
  • \{
  • \}
  • numbers??
suggestion

Most helpful comment

I agree reading backslashed chars is hard, and the problem is worth solving. I have some constraints though:

  • the resulting text should be exactly the same width for indentation not to change
  • Shouldn’t be too confusing, i.e. should be easy to figure out what the original text was
  • We don’t want false negatives (masking a char in the wrong context, in our example, render backslash as an escape character when it’s really not, e.g. in Windows file paths)

What I’m thinking right now is maybe making it thinner, and ignore if backslash is followed by another backslash immediately. From what I’ve seen backslashes are pretty much exclusively escape characters, with the exception of windows paths. I’ll give it some more thought, thanks!

All 2 comments

I agree reading backslashed chars is hard, and the problem is worth solving. I have some constraints though:

  • the resulting text should be exactly the same width for indentation not to change
  • Shouldn’t be too confusing, i.e. should be easy to figure out what the original text was
  • We don’t want false negatives (masking a char in the wrong context, in our example, render backslash as an escape character when it’s really not, e.g. in Windows file paths)

What I’m thinking right now is maybe making it thinner, and ignore if backslash is followed by another backslash immediately. From what I’ve seen backslashes are pretty much exclusively escape characters, with the exception of windows paths. I’ll give it some more thought, thanks!

From what I’ve seen backslashes are pretty much exclusively escape characters, with the exception of windows paths. I’ll give it some more thought, thanks!

This change doesn't look great for Coq/F*/etc, which use \/ (∨) for logical or and /\ for logical and (∧). (Iosevka has ligatures for these two). It doesn't work too well for Haskell either, which uses it for anonymous functions (\x -> x + 1) :: Num a => a -> a

I'm not sure how to fix these. Ignoring \ when preceded with a slash will break cases like sed 's/\(abc\)/xyz/g'; so would turning /\ into a ligature; for Haskell, it isn't clear that there's a valid ignore pattern, except for (\, and then that would look weird when used as an actual escape.

Not sure what the solution is.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whatisaphone picture whatisaphone  Â·  3Comments

aolko picture aolko  Â·  3Comments

miniBill picture miniBill  Â·  4Comments

mlajtos picture mlajtos  Â·  4Comments

blucell picture blucell  Â·  4Comments