8000 runtime(vim): Improve the indentation algorithm for "enum"s by zzzyxwvut · Pull Request #16310 · vim/vim · GitHub
[go: up one dir, main page]

Skip to content

runtime(vim): Improve the indentation algorithm for "enum"s #16310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions runtime/autol 8000 oad/dist/vimindent.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1055,19 +1055,16 @@ enddef

def IsInside(lnum: number, syntax: string): bool # {{{3
if syntax == 'EnumBlock'
var cur_pos = getpos('.')
defer setpos('.', getcurpos())
cursor(lnum, 1)
var enum_pos = search('^\C\s*\%(export\s\)\=\s*enum\s\+\S\+', 'bnW')
var endenum_pos = search('^\C\s*endenum\>', 'bnW')
setpos('.', cur_pos)

if enum_pos == 0 && endenum_pos == 0
const enum_pos: number = search('^\C\s*\%(export\s\+\)\=enum\s\+\S\+', 'bcnW')
if enum_pos == 0 || enum_pos == lnum
return false
endif
if (enum_pos > 0 && (endenum_pos == 0 || enum_pos > endenum_pos))
return true
endif
return false

const endenum_pos: number = search('^\C\s*endenum\>', 'bcnW')
return endenum_pos == 0 || (endenum_pos != lnum && enum_pos > endenum_pos)
endif

if !exists('b:vimindent')
Expand Down
Loading
0