diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-02-07 23:01:23 +0000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-02-07 23:01:23 +0000 |
| commit | 5342d67fa4eb5ce22e5d40c61a0db6bbb5fc52fd (patch) | |
| tree | a405264b875aadb1fca0cc57b6d2ccfec1a7927c /src | |
| parent | 033ded15ae0d0296f046b6c5feb53ef4e162f2ea (diff) | |
Remove unneeded padding in relative line numbers highlighting
We were still adding one more char to the line number width in case
it would contain a minus sign. The minus signs are not used anymore
in relative line numbering so we dont need to keep that addtional
char which is always a blank.
Diffstat (limited to 'src')
| -rw-r--r-- | src/highlighters.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc index dca11ab7..f5b57c03 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -744,14 +744,14 @@ void show_line_numbers(const Context& context, HighlightFlags flags, ++digit_count; char format[16]; - format_to(format, "%{}d{}", digit_count + (relative ? 1 : 0), separator); - int main_selection = (int)context.selections().main().cursor().line + 1; + format_to(format, "%{}d{}", digit_count, separator); + const int main_line = (int)context.selections().main().cursor().line + 1; for (auto& line : display_buffer.lines()) { const int current_line = (int)line.range().begin.line + 1; - const bool is_cursor_line = main_selection == current_line; + const bool is_cursor_line = main_line == current_line; const int line_to_format = (relative and not is_cursor_line) ? - current_line - main_selection : current_line; + current_line - main_line : current_line; char buffer[16]; snprintf(buffer, 16, format, std::abs(line_to_format)); DisplayAtom atom{buffer}; |
