[go: up one dir, main page]

Skip to content

Allow toggling a customizable character limit warning line

Description

It would be nice if we can enable a customizable line limit most IDEs have, especially while viewing merge requests.

Problem to solve

With the current way the diff view is displayed, when you're working on projects that have a conventional line limit to be enforced, there is no way on the diff view to see whether lines go beyond that limit

Proposal

Tested on Firefox 55.0:
I managed to do something similar using Firebug, by adding the following CSS rule.

.line_content::after {
  border-right: 1px solid rgba(255, 0, 0, 0.5);
  content: "";
  left: 80ch;
  position: absolute;
  top: 0;
  padding-left: inherit;
}

The rule uses the ch unit to position the border 80 characters to the right. It also inherits the padding from its parent to take into account the +, - or space character that pads the lines slightly to the right.

Screenshot

I took a random Merge Request (12934) from the repo here and added the previous CSS in the browser inspector. I also edited one of the lines so it includes numbers from start to end, so it wraps to the next line.

80-characters-line

Links / references

  1. Browser support for ch on MDN: https://developer.mozilla.org/en/docs/Web/CSS/length#compat-desktop
  2. Browser support for ch on "Can I use": http://caniuse.com/#search=ch
Edited by Nailia Iskhakova