Bug 419932 - Vi Keybindings - Replace modes not working correctly
Summary: Vi Keybindings - Replace modes not working correctly
Status: NEW
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Editor (show other bugs)
Version: 4.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2013-10-20 13:57 EDT by Stephen Jahns CLA
Modified: 2015-05-08 10:01 EDT (History)
2 users (show)

See Also:
s.t.jahns: review? (gheorghe)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Jahns CLA 2013-10-20 13:57:47 EDT
Hitting 'R' in normal mode should enter replace mode that writes over existing text -- this currently isn't working properly and is simply toggling overwrite mode once, so when returning to normal mode and entering insert mode again, text is still overwritten.

Hitting 'r' in normal mode followed by a character should replace the character under the cursor with the new character. (or replace the next N characters with the given character if 'r' is prefixed with a number N).
Comment 2 Bogdan Gheorghe CLA 2013-11-11 22:19:01 EST
Patch looks good - just a few things:

i) End location of caret after performing Number + r differs than in vi:

Take the following line:

License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

If you put the cursor on L and type '3r' then 'a' you end up with:

aaaense v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

With the caret position on the 3rd a. With the patch we end up on the first a.

ii) Can't do multiple Number + R. With the same line, if I start at L and type 3R then type bog and esc, I end up with the following in vi:

bogbogbog1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

iii) Both types of R changes should be using the undo compound changes to allow for undoing the operation in 1 step. Take a look at linkedMode.js#startUndo to see how this can be used.
Comment 3 Stephen Jahns CLA 2013-11-13 17:52:58 EST
(In reply to Bogdan Gheorghe from comment #2)
> Patch looks good - just a few things:
> 
> i) End location of caret after performing Number + r differs than in vi:
> 
> Take the following line:
> 
> License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
> 
> If you put the cursor on L and type '3r' then 'a' you end up with:
> 
> aaaense v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
> 
> With the caret position on the 3rd a. With the patch we end up on the first
> a.
> 
> ii) Can't do multiple Number + R. With the same line, if I start at L and
> type 3R then type bog and esc, I end up with the following in vi:
> 
> bogbogbog1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
> 
> iii) Both types of R changes should be using the undo compound changes to
> allow for undoing the operation in 1 step. Take a look at
> linkedMode.js#startUndo to see how this can be used.

I have an additional commit that addresses points i) and iii) here:
https://github.com/stjahns/orion.client/commit/9eb85d0ed03d26a16034ef1a2873fbe11e432754
Comment 4 Stephen Jahns CLA 2013-11-13 17:55:36 EST
ii) is more complicated, something I'll need to tackle later along with hitting '.' in normal mode to repeat the last edit, as hitting 3Raaa<esc> is equivalent to hitting Raaa<esc>.. (hitting the '.' key 2 times) or Raaa<esc>2.
Comment 5 Stephen Jahns CLA 2013-11-13 17:56:27 EST
ii) is also a problem for regular insert mode.