Describe the bug
Text property is not removed from all lines in range as promised by function prop_remove()
.
To Reproduce
Please follow exact steps with exact same files, most changes to temp.vim
below makes the issue non-reproducible.
temp.vim
, and steps.vim
in same directory on your machine.>>vim --clean -u steps.vim
or just vim -u steps.vim
."someprop"
) did not clear on line 40 when call prop_remove({'type':'someprop', 'bufnr':bufnr()},35,43)
is executed to remove it from all lines in range [35:43].command: >>vim --clean -u steps.vim
or just vim -u steps.vim
file steps.vim
:
set nocompatible filetype plugin on set noswapfile set updatetime=50 set updatecount=0 set number syntax enable silent edit temp.vim highlight SomeHighlight ctermfg=233 ctermbg=118 guifg=#121212 guibg=#87FF00 call prop_type_add('someprop', {'highlight': 'SomeHighlight', 'combine': 0}) call prop_add(1, 27, {'end_lnum': 1, 'end_col': 70, 'type': 'someprop', 'bufnr': bufnr()}) call prop_remove({'type':'someprop', 'bufnr':bufnr()},1,1) call prop_add(35, 22, {'end_lnum': 43, 'end_col': 43, 'type': 'someprop', 'bufnr': bufnr()}) call prop_remove({'type':'someprop', 'bufnr':bufnr()},35,43)
file temp.vim
(don't change anything, save it exactly as it is, don't even add extra line on top in file or additional space; reproducibility is sensitive to not changing contents of this file. First line in the file should go on first line in temp.vim
in the following code snippet):
" vim-plug plugin manager (from https://github.com/junegunn/vim-plug) " Specify a directory for plugins " - For Neovim: stdpath('data') . '/plugged' " - Avoid using standard Vim directory names like 'plugin' set nocompatible " no need to be compatible with old vim filetype plugin on set noswapfile set updatetime=50 " TODO: This is again set to 0 after loading plugins. ale/devicons comibanation gave some trouble in past, check again if a bigger value is needed set updatecount=0 " Colorscheme specific setup let g:ale_disable_lsp = 1 let g:airline_extensions = [] let g:airline#extensions#disable_rtp_load = 1 "let g:startify_disable_at_vimenter = 1 "let g:airline_disable_statusline = 1 "let g:loaded_ctrlp = 1 if !empty($VIM_TAB_COLOR) && !(str2nr($VIM_TAB_COLOR,10) == 0) let tabcolor=$VIM_TAB_COLOR else let tabcolor=244 endif function! DoNothing() let g:airline_disable_statusline = 0 set laststatus=0 set laststatus=2 "let g:loaded_ctrlp = 0 execute 'Startify' execute 'colorscheme PaperColor' "let g:vim_monokai_tasty_italic = 1 "colorscheme vim-monokai-tasty "let g:airline_theme='monokai_tasty' let &t_8f="\<Esc>[38;2;%lu;%lu;%lum" let &t_8b="\<Esc>[48;2;%lu;%lu;%lum" hi Function cterm=italic gui=italic term=italic hi Normal ctermbg=NONE guibg=NONE let g:afterglow_use_italics=1 let g:afterglow_italic_comments=1 hi! Comment cterm=italic gui=italic term=italic "call plug#load(keys(g:plugs)) "call plug#load(['ctrlpvim/ctrlp.vim']) | Helptags " hi Error ctermbg=NONE guibg=NONE " hi! Normal ctermbg=NONE guibg=NONE " hi! NonText ctermbg=NONE guibg=NONE " hi ErrorMsg ctermbg=NONE ctermfg=red guibg=NONE guifg=0xFF0000 " hi WarningMsg ctermbg=NONE ctermfg=magenta guibg=NONE guifg=#FF0088 " hi VertSplit ctermfg=241 ctermbg=NONE cterm=NONE guibg=NONE guifg=#777777 " " indentLine customization " let g:indentLine_char_list = ['│'] " let g:indentLine_concealcursor = 'inc' " let g:indentLine_conceallevel = 2 " let g:indentLine_defaultGroup = 'SpecialKey' " let g:indentLine_setColors = 1 " " let g:indentLine_bgcolor_term = 'NONE' " let g:indentLine_bgcolor_gui = 'NONE' " let g:indentLine_color_term = 240 " let g:indentLine_color_gui = '#555555' " " if !empty($VIM_TAB_COLOR) && !(str2nr($VIM_TAB_COLOR,10) == 0) " " let tabcolor=$VIM_TAB_COLOR " " else " " let tabcolor=244 " " endif endfunction "function! StartifyEntryFormat() " return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path' "endfunction "call plug#begin('~/.vim/plugged') " Make sure you use single quotes " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align " Any valid git URL is allowed "if has('nvim') " Plug 'caenrique/nvim-toggle-terminal' " nnoremap <silent> <leader>= :ToggleWindowTerminal<Enter> " tnoremap <silent> <leader>= <C-\><C-n>:ToggleWindowTerminal<Enter> " function! s:termCww() " let w:termcww=1 " exec 'wincmd w' " endfunction " tnoremap <silent> <C-w><C-w> <C-\><C-n> :call <SID>termCww()<CR> " tnoremap <silent> <C-w>w <C-\><C-n> :call <SID>termCww()<CR> " function! s:termWinEnter() " if &filetype==#'terminal' && mode()==#'n' && w:termcww==1 " let w:termcww=0 " call feedkeys('i','nt') " endif " endfunction " augroup TermCww " autocmd! " autocmd WinEnter * call <SID>termWinEnter() " augroup END "end "call plug#end()
Expected behavior
prop_remove()
should remove specified property on all lines in line range provided by the user.
Screenshots
Look at the uncleared green background on line 40:
Environment (please complete the following information):
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 24 2021 17:37:26)
macOS version - arm64
Included patches: 1-2884
Compiled by Homebrew
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
There are still a few magic numbers, but here is a simplified MWE:
vim -Nu NONE -S <(cat <<'EOF'
vim9script
var lines: list<string> = [repeat('x', 35)]->repeat(41)
+ [repeat('!', 35)]
+ [repeat('x', 35)]->repeat(56)
lines->setline(1)
prop_type_add('someprop', {highlight: 'ErrorMsg'})
prop_add(1, 27, {end_lnum: 1, end_col: 70, type: 'someprop'})
prop_remove({type: 'someprop'}, 1)
prop_add(35, 22, {end_lnum: 43, end_col: 43, type: 'someprop'})
prop_remove({type: 'someprop'}, 35, 43)
norm! 42G
EOF
)
@brammool Thanks. Btw, there are other problems with text properties. With @lacygoill 's example above if you remove last prop_remove
, and insert some text within the region it doesn't always apply the text property to the text added within the region in cases:
Moreover for more complex edits in my real world experience, I get internal errors associated with text properties if I edit the buffer.
Here's a video:
Command:
vim -Nu NONE -S <(cat <<'EOF' vim9script var lines: list<string> = [repeat('x', 35)]->repeat(41) + [repeat('!', 35)] + [repeat('x', 35)]->repeat(56) lines->setline(1) prop_type_add('someprop', {highlight: 'ErrorMsg'}) prop_add(1, 27, {end_lnum: 1, end_col: 70, type: 'someprop'}) prop_remove({type: 'someprop'}, 1
) prop_add(35, 22, {end_lnum: 43, end_col: 43, type: 'someprop'}) norm! 42G EOF )
Reopened #8261.
I can reproduce the effect in the video this using a 27 May 2021 build, but not with the latest code. So I think this can be closed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #8261.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
This todo item is no longer relevant:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.