~edwargix/git.sr.ht

0af916a82b93e3b125ca1de463d4d3500e947c1e — Drew DeVault 7 years ago 6ed66f7
Pull max line width from editorconfig in blob view
2 files changed, 7 insertions(+), 1 deletions(-)

M gitsrht/editorconfig.py
M gitsrht/templates/blob.html
M gitsrht/editorconfig.py => gitsrht/editorconfig.py +5 -0
@@ 48,6 48,11 @@ class EditorConfig:
            return 8
        return self._config.get("tab_size", self._config.get("indent_size", 8))

    def max_line_length(self):
        if self._config == None:
            return 80
        return self._config.get("max_line_length", 80)

# Via https://github.com/editorconfig/editorconfig-core-py/blob/master/editorconfig/fnmatch.py
# 2-Clause BSD


M gitsrht/templates/blob.html => gitsrht/templates/blob.html +2 -1
@@ 67,7 67,8 @@ pre, body {
  <div class="row" style="margin-right: 0;">
    {% if not blob.is_binary %}
    <div class="col-md-12 code-view">
      <pre class="ruler"><span>{% for i in range(80) %} {% endfor %}</span></pre>
      <pre class="ruler"><span>{% for i in range(
        editorconfig.max_line_length()) %} {% endfor %}</span></pre>
      <pre class="lines">{% for line in data.split("\n") %}<a
        href="#L{{loop.index}}"
        id="L{{loop.index}}"