Skip to content
Snippets Groups Projects

Wrap single lines of code; horizontally scroll multi-line code blocks

Merged Annabel Gray requested to merge scroll-code-blocks into master
1 unresolved thread

What does this MR do?

Original problem: code blocks were wrapping in issue body

  • Multi-line code blocks (```) should scroll horizontally
  • Single lines of code (`) should wrap

Why was this MR needed?

Inconsistent scrolling vs wrapping behavior

What are the relevant issue numbers?

Closes #19619 (closed)

Screenshots (if relevant)

Screen_Shot_2016-08-04_at_2.32.30_PM

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
14 14 margin-top: 0;
15 15 }
16 16
17 // Single code lines should wrap
17 18 code {
18 19 font-family: $monospace_font;
19 white-space: pre;
20 white-space: pre-wrap;
  • pre Sequences of whitespace are preserved, lines are only broken at newline characters in the source and at
    elements.


    pre-wrap Sequences of whitespace are preserved. Lines are broken at newline characters, at
    , and as necessary to fill line boxes.

    Why do we want pre-wrap instead of pre?

  • If you change that to pre, the single lines of code scroll instead of wrapping.

  • Please register or sign in to reply
  • Looks good. :thumbsup:

    Edited by Jacob Schatz
  • @alfredo1 if it's a code block, then yep. Should scroll. Only single-tick lines of code should wrap. If you put a line break in that though, it should preserve that line break

  • But the form should not be that wide IMO or is this intended?

  • @alfredo1 I see what you mean. It looks like that's how it currently functions in production as well, but we should address that in https://gitlab.com/gitlab-org/gitlab-ce/issues/20640. The goal will be to have the comment box scrolling independently of the diff table

    Edited by Annabel Gray
  • @annabeldunstone alright so this LGTM then!

  • Reassigned to @jschatz1

  • Annabel Gray Added 318 commits:

    Added 318 commits:

  • Jacob Schatz Added ~149423 label

    Added ~149423 label

  • Jacob Schatz Status changed to merged

    Status changed to merged

  • Jacob Schatz mentioned in commit 39c44977

    mentioned in commit 39c44977

  • Picked into 8-11-stable, will go into 8.11.0-rc6.

  • Rubén Dávila Removed ~149423 label

    Removed ~149423 label

  • Jacob Schatz mentioned in commit 24477045

    mentioned in commit 24477045

  • @annabeldunstone I don't know if this is related, but adding a code block with a really long line in a comment makes all of the comments (and the code) scroll. I'd expect code blocks to scroll separately from their containers.

    See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5968#note_14451132 for an example.

    Code_block_scroll

  • @smcgivern Yeah we're aware of that issue. That's going to be the case until we can pull the comment blocks completely out of the tables (there's an issue for that somewhere)

  • OK, thanks! I'm guessing this is the issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/20640

  • Please register or sign in to reply
    Loading