Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text properties not applied to hidden buffers when 'nohidden' is used #4808

Closed
nickspoons opened this issue Aug 12, 2019 · 2 comments

Comments

@nickspoons
Copy link

commented Aug 12, 2019

Describe the bug
When set nohidden is used and a text property is applied to a hidden buffer, the text property is not persisted and various errors can occur. There is no mention of 'hidden' in textprop.txt.

To Reproduce

  1. Run echo 'a' > a ; echo 'b' > b ; vim --clean a b
  2. :set nohidden
  3. :call prop_type_add('ErrorMsg', #{highlight:'ErrorMsg'})
  4. Highlight buffer 1:
    :call prop_add(1, 1, #{end_lnum:1,end_col:2,type:'ErrorMsg',bufnr:1})
  5. a is highlighted
  6. :next
  7. :prev
  8. a is no longer highlighted
  9. Highlight buffer 2:
    :call prop_add(1, 1, #{end_lnum:1,end_col:2,type:'ErrorMsg',bufnr:2})
  10. :next
  11. The buffer is empty
  12. :e
  13. The buffer is now populated with b again

Expected behavior
At step 8. above, I expected the text properties to be retained for the buffer, after navigating away and back again. If set hidden is used, the text properties are retained.

At step 11., something has clearly gone wrong - the contents of the buffer are missing.

Further bugs: To Reproduce

  1. Run echo 'a' > a ; echo 'bbb\nbbb\nbbb' > b ; vim --clean a b
  2. :set nohidden
  3. :call prop_type_add('ErrorMsg', #{highlight:'ErrorMsg'})
  4. Highlight buffer 2:
    :call prop_add(1, 2, #{end_lnum:2,end_col:2,type:'ErrorMsg',bufnr:2})
  5. E966: Invalid line number: 2

Expected behavior
Buffer 2 has 3 lines so this should be fine, but an error is reported.

Environment (please complete the following information):
Tested in arch linux terminal Vim 8.1.1839 (built from git) and Windows 10 gVim 8.1.1839 (from vim-win32-installer)

@brammool

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

@nickspoons

This comment has been minimized.

Copy link
Author

commented Aug 13, 2019

Thanks very much Bram, this is much better, consistent with a very clear error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.