Mercurial > vim
annotate runtime/indent/yacc.vim @ 23043:6616bf17dc94 v8.2.2068
patch 8.2.2068: transparent syntax item uses start/end of containing region
Commit: https://github.com/vim/vim/commit/b46f57e87b3706a8c4b97d8e03f7853a7938b061
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 29 14:11:41 2020 +0100
patch 8.2.2068: transparent syntax item uses start/end of containing region
Problem: Transparent syntax item uses start/end of containing region.
Solution: Do not change the startpos and endpos of a transparent region to
that of its containing region. (Adrian Ghizaru, closes #7349,
closes #7391)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 29 Nov 2020 14:15:05 +0100 |
parents | 1218c5353e2b |
children | 4d76b3e07c07 |
rev | line source |
---|---|
7 | 1 " Vim indent file |
11062 | 2 " Language: YACC input file |
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | |
4 " Latest Revision: 2006-12-20 | |
7 | 5 |
6 " Only load this indent file when no other was loaded. | |
7 if exists("b:did_indent") | |
8 finish | |
9 endif | |
10 | |
11 let b:did_indent = 1 | |
12 | |
13 setlocal indentexpr=GetYaccIndent() | |
14 setlocal indentkeys=!^F,o,O | |
1216 | 15 setlocal nosmartindent |
7 | 16 |
17 " Only define the function once. | |
18 if exists("*GetYaccIndent") | |
19 finish | |
20 endif | |
21 | |
22 function GetYaccIndent() | |
23 if v:lnum == 1 | |
24 return 0 | |
25 endif | |
26 | |
27 let ind = indent(v:lnum - 1) | |
28 let line = getline(v:lnum - 1) | |
29 | |
30 if line == '' | |
31 let ind = 0 | |
32 elseif line =~ '^\w\+\s*:' | |
33 let ind = ind + matchend(line, '^\w\+\s*') | |
34 elseif line =~ '^\s*;' | |
35 let ind = 0 | |
36 else | |
37 let ind = indent(v:lnum) | |
38 endif | |
39 | |
40 return ind | |
41 endfunction |