Bug 235862 - [VI Mode] Range operations in vi-input mode don't work
Summary: [VI Mode] Range operations in vi-input mode don't work
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-01 00:31 UTC by Matthijs
Modified: 2016-02-12 02:17 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthijs 2010-05-01 00:31:02 UTC
Version:           3.4.2 (using 4.4.2 (KDE 4.4.2), Arch Linux)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.33-ARCH

Ranges don't work correctly for at least the substitute command:

An example:
"try

also" (Couldn't think of anything better)

The command ->  ":/r/,/o/s/^/ha/"

Expected result:
"hatry
ha
haalso"

But kate says the command does not exist.

Range commands using . (implemented for a previous bug) don't work correctly either:

Example:
"much
much
much"

The command -> "3:s/much/try/" or ".,.+2s/much/try/"

Expected result:
"try
try
try"

Result:
"much
much
try"

The range seems not to be fully followed. I have had cases where I requested five lines, but kate ended up doing replacements on over 50 lines.
Comment 1 Elias Probst 2010-11-11 09:26:38 UTC
I can confirm this and would really like to see this fixed.
I often do visual selections and replace something in them, this doesn't work:

- Do a visual selection
- Start typing a command
- At the moment the : is entered, the visual selection is gone
Comment 2 Dominik Haumann 2013-08-14 11:47:33 UTC
Simon: Is this still an issue with all your changes?
Comment 3 Simon St James 2013-08-14 12:08:19 UTC
Dominik: There's a bit of a mix of bugs here:

a) The range is not entirely respected e.g. the 3:s/much/try/" & ".,.+2s/much/try/" examples;
b) The "r" command is not implemented; & 
c) Pressing ":" in Visual Mode immediately dismisses the selection.

a) Seems to be fixed; b) is not, and should be a separate bug report; as for c) - well, the selection is still technically immediately dismissed, but the fact that this is an operation to be carried out over the selected range is stored.  I can't immediately come up with a scenario where this would give a different result to Vim, so I'd class it as "fixed for all practical purposes".
Comment 4 Dominik Haumann 2013-08-14 12:34:37 UTC
Matthijs, Elias: Can you test again by following http://kate-editor.org/get-it/ ?
Comment 5 Boris Egorov 2016-02-12 02:17:18 UTC
Git commit 0ea97afbeddb19f598bab98e01f31869852bdf62 by Boris Egorov.
Committed on 12/02/2016 at 02:12.
Pushed by egorov into branch 'master'.

Add tests for #235862, just to make sure it is fixed

REVIEW: 127045

M  +4    -0    autotests/src/vimode/modes.cpp

http://commits.kde.org/ktexteditor/0ea97afbeddb19f598bab98e01f31869852bdf62