Mercurial > vim
annotate runtime/indent/chatito.vim @ 30799:ffa5492137c3 v9.0.0734
patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Commit: https://github.com/vim/vim/commit/2fbabd238a94022c99506e920186a5b6cdf15426
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 12 19:53:38 2022 +0100
patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'
Problem: Cursor position invalid when scrolling with 'smoothscroll' set.
(Ernie Rael)
Solution: Add w_valid_skipcol and clear flags when it changes. Adjust
w_skipcol after moving the cursor.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Oct 2022 21:00:05 +0200 |
parents | 1e91e26ceebf |
children |
rev | line source |
---|---|
30547 | 1 " Vim indent file |
2 " Language: Chatito | |
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org> | |
4 " Last Change: 2022 Sep 20 | |
5 | |
6 if exists('b:did_indent') | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal indentexpr=GetChatitoIndent() | |
12 setlocal indentkeys=o,O,*<Return>,0#,!^F | |
13 | |
14 let b:undo_indent = 'setl inde< indk<' | |
15 | |
16 if exists('*GetChatitoIndent') | |
17 finish | |
18 endif | |
19 | |
20 function GetChatitoIndent() | |
21 let l:prev = v:lnum - 1 | |
22 if getline(prevnonblank(l:prev)) =~# '^[~%@]\[' | |
23 " shift indent after definitions | |
24 return shiftwidth() | |
25 elseif getline(l:prev) !~# '^\s*$' | |
26 " maintain indent in sentences | |
27 return indent(l:prev) | |
28 else | |
29 " reset indent after a blank line | |
30 return 0 | |
31 end | |
32 endfunction |