annotate runtime/indent/logtalk.vim @ 13768:bcef80912112 v8.0.1756

patch 8.0.1756: GUI: after prompting for a number the mouse shape is wrong commit https://github.com/vim/vim/commit/73658317bacd9a0264dfaa32288de6ea1f236fe5 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 24 17:41:57 2018 +0200 patch 8.0.1756: GUI: after prompting for a number the mouse shape is wrong Problem: GUI: after prompting for a number the mouse shape is sometimes wrong. Solution: Call setmouse() after setting "State". (Hirohito Higashi, closes #2709)
author Christian Brabandt <cb@256bit.org>
date Tue, 24 Apr 2018 17:45:08 +0200
parents 63b0b7b79b25
children 5c5908e81e93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
1 " Maintainer: Paulo Moura <pmoura@logtalk.org>
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
2 " Revised on: 2008.06.02
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
3 " Language: Logtalk
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
4
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
5 " This Logtalk indent file is a modified version of the Prolog
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
6 " indent file written by Gergely Kontra
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
7
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
8 " Only load this indent file when no other was loaded.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
9 if exists("b:did_indent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
10 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
11 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
12
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
13 let b:did_indent = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
14
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
15 setlocal indentexpr=GetLogtalkIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
16 setlocal indentkeys-=:,0#
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
17 setlocal indentkeys+=0%,-,0;,>,0)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
18
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
19 " Only define the function once.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
20 if exists("*GetLogtalkIndent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
21 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
22 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
23
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
24 function! GetLogtalkIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
25 " Find a non-blank line above the current line.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
26 let pnum = prevnonblank(v:lnum - 1)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
27 " Hit the start of the file, use zero indent.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
28 if pnum == 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
29 return 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
30 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
31 let line = getline(v:lnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
32 let pline = getline(pnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
33
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
34 let ind = indent(pnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
35 " Previous line was comment -> use previous line's indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
36 if pline =~ '^\s*%'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
37 retu ind
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
38 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
39 " Check for entity opening directive on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
40 if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
41 let ind = ind + shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
42 " Check for clause head on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
43 elseif pline =~ ':-\s*\(%.*\)\?$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
44 let ind = ind + shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
45 " Check for entity closing directive on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
46 elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
47 let ind = ind - shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
48 " Check for end of clause on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
49 elseif pline =~ '\.\s*\(%.*\)\?$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
50 let ind = ind - shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
51 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
52 " Check for opening conditional on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
53 if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
54 let ind = ind + shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
55 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
56 " Check for closing an unclosed paren, or middle ; or ->
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
57 if line =~ '^\s*\([);]\|->\)'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 1668
diff changeset
58 let ind = ind - shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
59 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
60 return ind
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
61 endfunction