From 90c67463117dbf61101952963c3eb904037a87d7 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 2 Sep 2022 11:03:05 +0200 Subject: [PATCH] builder: correctly remember the previous group when switching alignment When `g:airline_skip_empty_sections' is set, and a section is considered and after that section comes the alignment separator '%=' than airline would not correctly render the airline_prevgroup_to_airline_curgroup simply because the '%=' marker confuses it about which is actually the previous group. So consider the '%=' marker to be empty as well. The case can be observed, when having set `g:airline_skip_empty_sections' to true and opening a help buffer. Because in that case, airline_section_c will be considered empty, then the alignment separator comes and after that airline will (wrongly) generate a highlighting group `airline_c_to_airline_z`, while it should actually generate `airline_b_to_airline_z` --- autoload/airline/builder.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/airline/builder.vim b/autoload/airline/builder.vim index 6c2a494c..426b3e2c 100644 --- a/autoload/airline/builder.vim +++ b/autoload/airline/builder.vim @@ -199,7 +199,12 @@ function! s:section_is_empty(self, content) return 0 endif - if empty(a:content) + " special case: When the content is %=, that is the + " separation marker, which switches between left- and + " right-aligned content. + " Consider that to be empty, so that the previous previous + " group is correctly remembered in the builder() function + if empty(a:content) || a:content is# '%=' return 1 endif