nvim-scrollbar icon indicating copy to clipboard operation
nvim-scrollbar copied to clipboard

Works incorrectly when a line is too long and is split into multiple lines

Open ouuan opened this issue 2 years ago • 5 comments

Describe the bug

When a line is too long and is split into multiple lines, the scrollbar behaves incorrectly.

To Reproduce

  1. Fill the screen with long lines that don't fit into a single line.
  2. The scrollbar appears only when there are enough text lines, instead of enough visual lines.
  3. The scrollbar character only appears at the first visual line of each text line and seems broken. Some lines even don't have the scrollbar character.

Expected behavior

  1. The scrollbar appears when the screen is full, instead of when there are enough text lines.
  2. The scrollbar appearance should be continuous.

Screenshots

broken scrollbar

Version Info (please complete the following information):

  • nvim --version
NVIM v0.7.0-dev+1132-g15004473b5
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-git/src/build/config -I/build/neovim-git/src/neovim-git/src -I/usr/include -I/build/neovim-git/src/build/src/nvim/auto -I/build/neovim-git/src/build/include
Compiled by builduser

Features: +acl +iconv +tui

ouuan avatar Feb 24 '22 13:02 ouuan

Yep, this is a bug when vim.opt.wrap = true.

I'm unsure of a fix for this at the moment. I believe this can fix it but I haven't had a chance to look at it yet.

petertriho avatar Feb 25 '22 15:02 petertriho

Yep, this is a bug when vim.opt.wrap = true.

I'm unsure of a fix for this at the moment. I believe this can fix it but I haven't had a chance to look at it yet.

This is also occour when i set wrap to false image

thaiducdung255 avatar Apr 05 '22 02:04 thaiducdung255

Maybe something can be gleaned from how nvim-scrollview accomplishes this?

adrian5 avatar Oct 04 '22 00:10 adrian5

Yep, this is a bug when vim.opt.wrap = true. I'm unsure of a fix for this at the moment. I believe this can fix it but I haven't had a chance to look at it yet.

This is also occour when i set wrap to false image

I got the same case with nowrap. And I found set the argument col=0 to the function nvim_buf_set_extmark of https://github.com/petertriho/nvim-scrollbar/blob/main/lua/scrollbar/init.lua#L161 and https://github.com/petertriho/nvim-scrollbar/blob/main/lua/scrollbar/init.lua#L177 can resolve this case. (But still not works for wrap. And not works with multi-bytes character where scrollbar mark is going to place)

yehuohan avatar Oct 19 '22 15:10 yehuohan

Still break scrollbar for line with wrap. Would be nice to fix it. Thanks for the great plugin btw!

edshamis avatar Apr 08 '23 11:04 edshamis