Mercurial > vim
view runtime/indent/postscr.vim @ 31142:7b16ac81a349 v9.0.0905
patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Commit: https://github.com/vim/vim/commit/02edfaa610a2bedd6e2a58a1ee64488d51cfc33d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 18 23:13:47 2022 +0000
patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Problem: Virtual text after the line wraps when 'wrap' is off.
Solution: Only set text_prop_follows when wrapping. (closes https://github.com/vim/vim/issues/11463)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Nov 2022 00:15:03 +0100 |
parents | 57c9377b9c62 |
children |
line wrap: on
line source
" PostScript indent file " Language: PostScript " Maintainer: Mike Williams <mrw@eandem.co.uk> " Last Change: 2022 Apr 06 " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=PostscrIndentGet(v:lnum) setlocal indentkeys+=0],0=>>,0=%%,0=end,0=restore,0=grestore indentkeys-=:,0#,e let b:undo_indent = "setl inde< indk<" " Catch multiple instantiations if exists("*PostscrIndentGet") finish endif function! PostscrIndentGet(lnum) " Find a non-empty non-comment line above the current line. " Note: ignores DSC comments as well! let lnum = a:lnum - 1 while lnum != 0 let lnum = prevnonblank(lnum) if getline(lnum) !~ '^\s*%.*$' break endif let lnum = lnum - 1 endwhile " Hit the start of the file, use user indent. if lnum == 0 return -1 endif " Start with the indent of the previous line let ind = indent(lnum) let pline = getline(lnum) " Indent for dicts, arrays, and saves with possible trailing comment if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$' let ind = ind + shiftwidth() endif " Remove indent for popped dicts, and restores. if pline =~ '\(end\|g\=restore\)\s*$' let ind = ind - shiftwidth() " Else handle immediate dedents of dicts, restores, and arrays. elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)' let ind = ind - shiftwidth() " Else handle DSC comments - always start of line. elseif getline(a:lnum) =~ '^\s*%%' let ind = 0 endif " For now catch excessive left indents if they occur. if ind < 0 let ind = -1 endif return ind endfunction " vim:sw=2