Mercurial > vim
view runtime/indent/raku.vim @ 33732:b140246564f4 v9.0.2095
patch 9.0.2095: statusline may look different than expected
Commit: https://github.com/vim/vim/commit/6a650bf696f1df3214b3d788947447c5bbf1a77d
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Nov 8 21:23:29 2023 +0100
patch 9.0.2095: statusline may look different than expected
Problem: statusline may look different than expected
Solution: do not check for highlighting of stl and stlnc characters
statusline fillchar may be different than expected
If the highlighting group for the statusline for the current window
|hl-StatusLine| or the non-current window |hl-StatusLineNC| are cleared
(or do not differ from each other), than Vim will use the hard-coded
fallback values '^' (for the non-current windows) or '=' (for the
current window). I believe this was done, to make sure the statusline
will always be visible and be distinguishable from the rest of the
window.
However, this may be unexpected, if a user explicitly defined those
fillchar characters just to notice that those values are then not used
by Vim.
So, let's assume users know what they are doing and just always return
the configured stl and stlnc values. And if they want the statusline to
be non-distinguishable from the rest of the window space, so be it. It
is their responsibility and Vim shall not know better what to use.
fixes: #13366
closes: #13488
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 08 Nov 2023 21:30:04 +0100 |
parents | 5c220cf30f1f |
children |
line wrap: on
line source
" Vim indent file " Language: Perl 6 " Maintainer: vim-perl <vim-perl@googlegroups.com> " Homepage: https://github.com/vim-perl/vim-perl " Bugs/requests: https://github.com/vim-perl/vim-perl/issues " Last Change: 2020 Apr 15 " 2023 Aug 28 by Vim Project (undo_indent) " Contributors: Andy Lester <andy@petdance.com> " Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> " " Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr> " Suggestions and improvements by : " Aaron J. Sherman (use syntax for hints) " Artem Chuprina (play nice with folding) " TODO: " This file still relies on stuff from the Perl 5 syntax file, which Perl 6 " does not use. " " Things that are not or not properly indented (yet) : " - Continued statements " print "foo", " "bar"; " print "foo" " if bar(); " - Multiline regular expressions (m//x) " (The following probably needs modifying the perl syntax file) " - qw() lists " - Heredocs with terminators that don't match \I\i* " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 " Is syntax highlighting active ? let b:indent_use_syntax = has("syntax") setlocal indentexpr=GetRakuIndent() " we reset it first because the Perl 5 indent file might have been loaded due " to a .pl/pm file extension, and indent files don't clean up afterwards setlocal indentkeys& setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and if !b:indent_use_syntax setlocal indentkeys+=0=EO endif let b:undo_indent = "setlocal indentexpr< indentkeys<" let s:cpo_save = &cpo set cpo-=C function! GetRakuIndent() " Get the line to be indented let cline = getline(v:lnum) " Indent POD markers to column 0 if cline =~ '^\s*=\L\@!' return 0 endif " Get current syntax item at the line's first char let csynid = '' if b:indent_use_syntax let csynid = synIDattr(synID(v:lnum,1,0),"name") endif " Don't reindent POD and heredocs if csynid =~ "^rakuPod" return indent(v:lnum) endif " Now get the indent of the previous perl line. " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) " Hit the start of the file, use zero indent. if lnum == 0 return 0 endif let line = getline(lnum) let ind = indent(lnum) " Skip heredocs, POD, and comments on 1st column if b:indent_use_syntax let skippin = 2 while skippin let synid = synIDattr(synID(lnum,1,0),"name") if (synid =~ "^rakuPod" || synid =~ "rakuComment") let lnum = prevnonblank(lnum - 1) if lnum == 0 return 0 endif let line = getline(lnum) let ind = indent(lnum) let skippin = 1 else let skippin = 0 endif endwhile endif if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$' let ind = ind + &sw endif if cline =~ '^\s*[)}\]»>]' let ind = ind - &sw endif " Indent lines that begin with 'or' or 'and' if cline =~ '^\s*\(or\|and\)\>' if line !~ '^\s*\(or\|and\)\>' let ind = ind + &sw endif elseif line =~ '^\s*\(or\|and\)\>' let ind = ind - &sw endif return ind endfunction let &cpo = s:cpo_save unlet s:cpo_save " vim:ts=8:sts=4:sw=4:expandtab:ft=vim