Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Folded code unfolds if you spend some (unknown number) of ms idle in a fold

Open phrohdoh opened this issue 9 years ago • 77 comments

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


What did you do?

Scrolled through folded code once with the j key held down, another time pressing it over and over.

What did you expect to happen?

Folded lines were skipped.

What happened instead?

Cursor did not skip the folded lines (watch the line numbers in the gif).

Technical details:

  • VSCode Version: 1.6.1
  • VsCodeVim Version: 0.4.0
  • OS: macOS Sierra (10.12)

vscode-vim-skip-folds

phrohdoh avatar Oct 27 '16 20:10 phrohdoh

This is annoying, but also hard. @aminroosta tried but had a bad time: https://github.com/VSCodeVim/Vim/pull/708

The problem as I understand it is that the only API VSCode allows us is "cursorMove" to move the cursor over folded lines, but we would actually like to know the position of the cursor as well (which "cursorMove" does not provide).

johnfn avatar Oct 27 '16 23:10 johnfn

on ubuntu, i also suffer from this a log I found the solution using gg to jump to the last line

ta3pks avatar Oct 28 '16 08:10 ta3pks

gg takes you to the first column on the first row, not the last line.

phrohdoh avatar Nov 01 '16 18:11 phrohdoh

@Phrohdoh for example 25gg will take you to 25th line not the beginning i meant end of the block by last line

ta3pks avatar Nov 01 '16 20:11 ta3pks

@NikosEfthias Oh I see, TIL. Thanks!

phrohdoh avatar Nov 01 '16 21:11 phrohdoh

I can confirm this on VSCode 1.9.1 with Vim Plugin 0.5.3.

This makes working with larger, more complex files very unwieldy!

I've tried disabling the vim plugin and moving with the cursor keys. In that case it works as expected (folds remain closed).

exhuma avatar Feb 23 '17 10:02 exhuma

+1 for this. Having my folds open while I'm navigating is quite frustrating. I find myself having to use my mouse to reposition my cursor, which should make all of us sad.

skawaii avatar Mar 02 '17 16:03 skawaii

+1 for fixing this asap

zwing99 avatar Mar 07 '17 04:03 zwing99

+1 for this. It makes me very painful.

ztmdsbt avatar Mar 07 '17 04:03 ztmdsbt

+1 comments aren't going to do anything but annoy the repo owners. Please use the 👍 reaction on the original post instead. Be kind to repo owners and other subscribed users.

phrohdoh avatar Mar 07 '17 04:03 phrohdoh

Oops now I'm spamming (I didn't mean to close this).

phrohdoh avatar Mar 07 '17 04:03 phrohdoh

:) It's okay. We generally use thumbs up as a measure of importance, but the extra signal we get from people who were so bothered they had to come and leave a comment is a little useful too. We're definitely aware this one is painful - we'll try to fix it as soon as we can!

johnfn avatar Mar 07 '17 05:03 johnfn

Investigated this and realized it required some help from VSCode. Opened up an issue over there: https://github.com/Microsoft/vscode/issues/22276

johnfn avatar Mar 09 '17 07:03 johnfn

Related: https://github.com/Microsoft/vscode/issues/25097

Glad to hear I'm not the first one to experience it.

calebmeyer avatar Apr 24 '17 15:04 calebmeyer

sorry to say, but this makes the extension useless for me.

greetz...

equinoxr avatar May 14 '17 09:05 equinoxr

I polished up my fix over here: https://github.com/VSCodeVim/Vim/pull/1552

It does some hackish stuff, but it seems to work great for me. Here's a pretty bad demo:

test

Chillee avatar May 16 '17 05:05 Chillee

We just pushed out a new version, so enable vim.foldfix and tell us what you think!

It's a hack and not a proper solution to this problem, so we'll probably leave this issue open for now.

Chillee avatar May 25 '17 21:05 Chillee

Has anybody tried out the new fix yet? Do you guys think it's workable as a proper fix (ie: this issue can be closed)?

Chillee avatar May 29 '17 19:05 Chillee

I haven't tried it but you yourself said the implementation is a hack so IMO shouldn't be considered a proper fix. Am I misunderstanding?

phrohdoh avatar May 29 '17 19:05 phrohdoh

Well, it is kinda hackish, but imo, if there's no difference for the user, then I would consider it a "proper fix".

Chillee avatar May 29 '17 19:05 Chillee

For me, when I keep pressing j or k key, the cursor jumps sometimes to previous line (flickers) so I rather use gj/gk hack because in that case the cursor does not jump/flicker - only when I release the key, it keeps moving for couple of more lines.

CendaL avatar May 30 '17 05:05 CendaL

@Chillee This is working great for me so far! I haven't noticed any issues with navigating over folds. So while the implementation may be "hackish", from a UX point of view I can't tell at all.

skawaii avatar May 30 '17 13:05 skawaii

I would say "partially fixed". I can navigate over folds but if i initiate a fold from inside from anywhere but the top of of the folding block then it immediately unfolds. This is certainly better than before though. VSCode v1.12.2 Vim v0.8.4

zwing99 avatar May 30 '17 15:05 zwing99

Good catch, @zwing99! I'm seeing the same thing on my end, as well.

skawaii avatar May 30 '17 15:05 skawaii

@skawaii @CendaL that's the type of feedback I was looking for.

The zc issue is a separate one: one that we didn't fix before because folds were practically unusable anyways imo.

Chillee avatar May 30 '17 20:05 Chillee

@CendaL Yep that's currently an unavoidable consequence of this hack :(

@skawaii @zwing99 Could one of you open up a new issue to track this new bug?

Chillee avatar Jun 02 '17 16:06 Chillee

@Chillee Sure. I created a ticket (#1803).

skawaii avatar Jun 02 '17 20:06 skawaii

@skawaii @zwing99 I fixed the zc issue in the newest version.

Chillee avatar Jun 11 '17 23:06 Chillee

@Chillee After the test, I found that 'zczc' didn't work on multiple fold levels.

arzyu avatar Jun 12 '17 02:06 arzyu

@Chillee It looks good to me! Thanks for the fix!

skawaii avatar Jun 12 '17 13:06 skawaii