-
-
Notifications
You must be signed in to change notification settings - Fork 281
Description
Currently the text of a code block is only highlighted until the end of a line, and empty lines also look like they 'split' a code block, since there is no background color on that line at all.
This was considered in a few ways in the last 3 commits of #1012: (not the last)
- padding each line to the end of the longest line
- limiting the maximum length to some fixed content based on an estimate reasonable width, for cases where the code could be very long on a few lines only (avoiding everything wrapping)
This was previously discussed in #zulip-terminal > Syntax-highlighting using pygments #T1012, though I'm not sure there was a follow-up topic to specifically handle these remaining points.
The challenge with both of the approaches above, is that long-line code can wrap on one or many lines, which can make the code block look quite messy.
The user can already view the raw/rendered full message via the message information popup, and if we enable the user to copy a code block from there too, we could trim the end of long lines.
However, this depends on specifying a length to trim the line:
- We could set it arbitrarily as per the second bullet above (which would avoid wrapping)
- We could make it act dynamically
The latter point is challenging since all message content is currently treated as styled input to a single urwid.Text widget.