annotate runtime/indent/tcsh.vim @ 32981:2415680a2554 v9.0.1783

commit b557f4898208105b674df605403cac1b1292707b Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Aug 22 22:07:34 2023 +0200 patch 9.0.1783: Display issues with virt text smoothscroll and showbreak Problem: Wrong display with wrapping virtual text or unprintable chars, 'showbreak' and 'smoothscroll'. Solution: Don't skip cells taken by 'showbreak' in screen lines before "w_skipcol". Combined "n_skip" and "skip_cells". closes: #12597 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 24 Aug 2023 07:47:10 +0200
parents 3b34837f4538
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: C-shell (tcsh)
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
4 " Previous Maintainer: Gautam Iyer <gi1242+vim@NoSpam.com> where NoSpam=gmail (Original Author)
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
5 " Last Change: 2021 Oct 15
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentexpr=TcshGetIndent()
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
15 setlocal indentkeys+=e,0=end
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
16 setlocal indentkeys-=0{,0},0),:,0#
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
17
25880
9c221ad9634a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
18 let b:undo_indent = "setl inde< indk<"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 if exists("*TcshGetIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 function TcshGetIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let lnum = prevnonblank(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " Hit the start of the file, use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Add indent if previous line begins with while or foreach
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " OR line ends with case <str>:, default:, else, then or \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let line = getline(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
39 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 if line =~ '\v^\s*breaksw>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
43 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
46 " Subtract indent if current line has on end, endif, endsw, case commands
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 let line = getline(v:lnum)
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
48 if line =~ '\v^\s*%(else|end|endif|endsw)\s*$'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
49 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 endfunction