Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render code blocks as ~rectangular, not just where code exists #1347

Open
neiljp opened this issue Mar 22, 2023 · 0 comments
Open

Render code blocks as ~rectangular, not just where code exists #1347

neiljp opened this issue Mar 22, 2023 · 0 comments
Labels
area: message rendering enhancement New feature or request further discussion required Discuss this on #zulip-terminal on chat.zulip.org

Comments

@neiljp
Copy link
Collaborator

neiljp commented Mar 22, 2023

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.

@neiljp neiljp added further discussion required Discuss this on #zulip-terminal on chat.zulip.org area: message rendering enhancement New feature or request labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: message rendering enhancement New feature or request further discussion required Discuss this on #zulip-terminal on chat.zulip.org
Projects
None yet
Development

No branches or pull requests

1 participant