randomPoison / text-edit

1 stars 0 forks source link

Newline characters ('\n') render as a box #6

Open randomPoison opened 7 years ago

randomPoison commented 7 years ago

newline_box

For some reason carriage return ('\r') is treated correctly as an invisible, but newline ('\n') isn't. That might be specific to how the Hack font is setup, but we should be a bit more clever about how invisibles, especially those at the end of lines, are handled. The simplest solution I can think of is to do a simple substitution replacing '\r' and '\n' with space (' '). I'd also like to have a visible whitespace option, but that's worth making it's own issue (though the two could use the same functionality).

Note that trimming trailing whitespace isn't a good solution. The cursor can move passed some trailing whitespace (e.g. spaces and tabs) so it needs to be accounted for in the text layout.