Mercurial > vim
annotate runtime/indent/idlang.vim @ 10801:e7b8be5ecacd v8.0.0290
patch 8.0.0290: cursor positioning wrong if wide character wraps
commit https://github.com/vim/vim/commit/04e87b72c5fa88b7034a5b0ec0be6a7ad763e9d2
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 1 21:23:10 2017 +0100
patch 8.0.0290: cursor positioning wrong if wide character wraps
Problem: If a wide character doesn't fit at the end of the screen line, and
the line doesn't fit on the screen, then the cursor position may
be wrong. (anliting)
Solution: Don't skip over wide character. (Christian Brabandt, closes #1408)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 01 Feb 2017 21:30:04 +0100 |
parents | dd6c2497c997 |
children | 63b0b7b79b25 |
rev | line source |
---|---|
7 | 1 " IDL (Interactive Data Language) indent file. |
2 " Language: IDL (ft=idlang) | |
3526
dd6c2497c997
Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents:
7
diff
changeset
|
3 " Last change: 2012 May 18 |
7 | 4 " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> |
5 | |
6 " Only load this indent file when no other was loaded. | |
7 if exists("b:did_indent") | |
8 finish | |
9 endif | |
10 let b:did_indent = 1 | |
11 | |
3526
dd6c2497c997
Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents:
7
diff
changeset
|
12 setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHILE,0=endfor,0=ENDFOR,0=endrep,0=ENDREP |
7 | 13 |
14 setlocal indentexpr=GetIdlangIndent(v:lnum) | |
15 | |
16 " Only define the function once. | |
17 if exists("*GetIdlangIndent") | |
18 finish | |
19 endif | |
20 | |
21 function GetIdlangIndent(lnum) | |
22 " First non-empty line above the current line. | |
23 let pnum = prevnonblank(v:lnum-1) | |
24 " v:lnum is the first non-empty line -- zero indent. | |
25 if pnum == 0 | |
26 return 0 | |
27 endif | |
28 " Second non-empty line above the current line. | |
29 let pnum2 = prevnonblank(pnum-1) | |
30 | |
31 " Current indent. | |
32 let curind = indent(pnum) | |
33 | |
34 " Indenting of continued lines. | |
35 if getline(pnum) =~ '\$\s*\(;.*\)\=$' | |
36 if getline(pnum2) !~ '\$\s*\(;.*\)\=$' | |
37 let curind = curind+&sw | |
38 endif | |
39 else | |
40 if getline(pnum2) =~ '\$\s*\(;.*\)\=$' | |
41 let curind = curind-&sw | |
42 endif | |
43 endif | |
44 | |
45 " Indenting blocks of statements. | |
46 if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>' | |
47 if getline(pnum) =~? 'begin\>' | |
48 elseif indent(v:lnum) > curind-&sw | |
49 let curind = curind-&sw | |
50 else | |
51 return -1 | |
52 endif | |
53 elseif getline(pnum) =~? 'begin\>' | |
54 if indent(v:lnum) < curind+&sw | |
55 let curind = curind+&sw | |
56 else | |
57 return -1 | |
58 endif | |
59 endif | |
60 return curind | |
61 endfunction | |
62 |