Mercurial > vim
annotate runtime/indent/sass.vim @ 18309:2047cb93eb0c v8.1.2149
patch 8.1.2149: crash when running out of memory very early
Commit: https://github.com/vim/vim/commit/e3a22cb1ba057381be3e645479a537f8032f119f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 14 22:01:57 2019 +0200
patch 8.1.2149: crash when running out of memory very early
Problem: Crash when running out of memory very early.
Solution: Do not use IObuff when it's NULL. (closes https://github.com/vim/vim/issues/5052)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Oct 2019 22:15:03 +0200 |
parents | 63b0b7b79b25 |
children | dce918af0c00 |
rev | line source |
---|---|
1668 | 1 " Vim indent file |
2202 | 2 " Language: Sass |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
11518 | 4 " Last Change: 2017 Jun 13 |
1668 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal autoindent sw=2 et | |
12 setlocal indentexpr=GetSassIndent() | |
13 setlocal indentkeys=o,O,*<Return>,<:>,!^F | |
14 | |
15 " Only define the function once. | |
16 if exists("*GetSassIndent") | |
17 finish | |
18 endif | |
19 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
20 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
21 let s:extend = '^\s*\%(@extend\|@include\|+\)' |
1668 | 22 |
23 function! GetSassIndent() | |
24 let lnum = prevnonblank(v:lnum-1) | |
25 let line = substitute(getline(lnum),'\s\+$','','') | |
26 let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') | |
27 let lastcol = strlen(line) | |
28 let line = substitute(line,'^\s\+','','') | |
29 let indent = indent(lnum) | |
30 let cindent = indent(v:lnum) | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
31 if line !~ s:property && line !~ s:extend && cline =~ s:property |
11518 | 32 return indent + shiftwidth() |
1668 | 33 else |
34 return -1 | |
35 endif | |
36 endfunction | |
37 | |
38 " vim:set sw=2: |