Skip to content

Commit

Permalink
Fix #525 I in reverse Visual mode should enter Insert mode at SOL
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardroche committed Apr 30, 2019
1 parent d46bd6b commit 19fde47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -27,7 +27,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt

### Fixed

* Fixed [#524](https://github.com/NeoVintageous/NeoVintageous/issues/524): `g_` should not include trailing whitespace
* Fixed [#525](https://github.com/NeoVintageous/NeoVintageous/issues/525): `I` in reverse Visual mode should enter Insert mode at SOL
* Fixed [#524](https://github.com/NeoVintageous/NeoVintageous/issues/524): `g_` should not include trailing WS
* Fixed [#523](https://github.com/NeoVintageous/NeoVintageous/issues/523): `g_` in Visual mode is off-by-one
* Fixed [#522](https://github.com/NeoVintageous/NeoVintageous/issues/522): `B` in Visual mode is off-by-one
* Fixed [#521](https://github.com/NeoVintageous/NeoVintageous/issues/521): `[count]d|` off-by-one
Expand Down
8 changes: 5 additions & 3 deletions nv/commands.py
Expand Up @@ -1726,14 +1726,16 @@ class _vi_big_i(ViTextCommandBase):

def run(self, edit, mode=None, count=1):
def f(view, s):
begin = view.line(s.begin()).a

if mode == VISUAL:
s = Region(view.line(s.a).a)
s = Region(begin)
elif mode == VISUAL_LINE:
s = Region(next_non_white_space_char(view, view.line(s.begin()).a))
s = Region(begin)
elif mode == VISUAL_BLOCK:
s = Region(s.begin())
elif mode == INTERNAL_NORMAL:
s = Region(next_non_white_space_char(view, view.line(s.b).a))
s = Region(begin)

return s

Expand Down
12 changes: 4 additions & 8 deletions tests/functional/test__big_i.py
Expand Up @@ -25,18 +25,14 @@ def test_I(self):
self.eq('abc|d', 'I', 'i_|abcd')
self.eq('x\nab|cd', 'I', 'i_x\n|abcd')

def test_v_I(self):
def test_v(self):
self.eq('x|ab|x', 'v_I', 'i_|xabx')
self.eq('x\na|bx|\n', 'v_I', 'i_x\n|abx\n')

def test_v_I_reverse(self):
self.eq('r_xa|bc|x', 'v_I', 'i_|xabcx')

def test_l_I(self):
self.eq('x\n|ab\n|x', 'l_I', 'i_x\n|ab\nx')

def test_l_I_reverse(self):
self.eq('r_x\n|ab\n|x', 'l_I', 'i_x\n|ab\nx')
self.eq('r_| fizz\n|x', 'l_I', 'i_| fizz\nx')
self.eq('fizz\nbu|zz\nfi|zz', 'l_I', 'i_fizz\n|buzz\nfizz')

def test_b_I(self):
def test_b(self):
self.eq('x\na|bc|d\nx\nc|de|f\nx', 'b_I', 'i_x\na|bcd\nx\nc|def\nx')

0 comments on commit 19fde47

Please sign in to comment.