Bug 376934 - Kate (apparently) does not account for code folder when searching with '/' in vi-mode
Summary: Kate (apparently) does not account for code folder when searching with '/' in...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: 15.12
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-26 01:10 UTC by Erik Andersen (Azendale)
Modified: 2021-01-02 14:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screencapture of how to reproduce the bug (508.30 KB, video/ogg)
2017-02-26 01:23 UTC, Erik Andersen (Azendale)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Andersen (Azendale) 2017-02-26 01:10:46 UTC
It appears that Kate doesn't account for code folding when searching in vi-mode.

Testcase:

create a document with a foldable section. Inside of that foldable section, put a unique string. Place another copy of the same unique string before the foldable code. Put a few more lines then in the foldable section after the foldable section.

Fold the foldable code section.

Place your cursor before the first copy of the unique string.

Press '/' and type the unique string followed by a newline.

(You should have jumped to the first (non-folded) instance of the string while you were typing the unique string into the search bar, and should still be on it after pressing enter.)

Press 'n' to go to the next result.

You should jump to after the foldable section. I notice that the number of lines past the foldable section you jump is equal to the number of lines (starting from the start of the foldable section) into the foldable section the result is.

Bug 282323 might be the same thing, but I can't seem to figure out how to change the status (maybe I don't have permission?)

This is on Ubuntu 16.04 Trusty using the Ubuntu packages.
Comment 1 Erik Andersen (Azendale) 2017-02-26 01:23:58 UTC
Created attachment 104225 [details]
Screencapture of how to reproduce the bug
Comment 2 Bug Janitor Service 2020-12-27 03:15:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/53
Comment 3 Christoph Cullmann 2021-01-02 14:11:26 UTC
Git commit dd7fd88eb5084fecd08626e0e82b5007dac50eba by Christoph Cullmann, on behalf of Jan Paul Batrina.
Committed on 02/01/2021 at 14:11.
Pushed by cullmann into branch 'master'.

[Vimode]Fix search inside fold ranges

Jumping to search matches in vimode (n/N) are implemented as motions and they are handled by NormalViMode::handleKeyPress which excludes code folds when jumping to lines. This works fine for most motions (e.g. jkG should skip folds to be consistent with Normal Kate mode), but introduces problems when matching searches as the cursor will be placed in position without the range being unfolded.

M  +12   -7    src/vimode/modes/normalvimode.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/dd7fd88eb5084fecd08626e0e82b5007dac50eba