Skip to content

Commit

Permalink
Fix parsing of highlight with small windows
Browse files Browse the repository at this point in the history
If there are insufficient columns to list all attributes of a highlight
group on one line the output will split the output over multiple lines.
This happens not only interactively but also when we call highlight with
execute() or capture the output with redir. In such circumstances the
remaining attributes that extend past the newline are indented with
leading spaces such that they are visually aligned with the attributes
on the prior line.

This accounts for such a possibility and ensures that the full contents
of a highlight group is on a single line.
  • Loading branch information
g0xA52A2A committed Mar 3, 2019
1 parent 9eee2a6 commit a0ab9b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autoload/zenchrome.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
function! zenchrome#GetColors()
let colors = {}
for highlight in split(execute('highlight'), '\n')
" Ensure one highlight group per line
let highlights = substitute(execute('highlight'), '\n\s\+', ' ', 'g')
for highlight in split(highlights, '\n')
let attributes = {}
let group = split(highlight)[0]
let group_attributes = split(highlight)[2:]
Expand Down

0 comments on commit a0ab9b9

Please sign in to comment.