Skip to content

Commit

Permalink
fixes #28 (GH): dd in last line must delete the whole line too if lin…
Browse files Browse the repository at this point in the history
…e is not empty
  • Loading branch information
guillermooo committed Feb 2, 2013
1 parent e8d87bc commit 232e549
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions transformers_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ class _vi_dd_post_motion(sublime_plugin.TextCommand):
def run(self, edit, mode=None):
def f(view, s):
if view.substr(s.b - 1) != '\n':
if s == view.full_line(view.size()):
return sublime.Region(s.a - 1, view.size())
return sublime.Region(s.a, view.full_line(s.b).b)
return s

Expand Down Expand Up @@ -288,7 +290,7 @@ def f(view, s):
state = VintageState(view)
if state.mode == MODE_VISUAL:
if not utils.is_region_reversed(view, s):

if (view.line(s.b - 1).empty() and
view.substr(s.b) not in (' \t') and
not view.line(s.b).empty()):
Expand Down Expand Up @@ -816,4 +818,4 @@ def f(view, s):
return sublime.Region(s.a, s.b - 1)
return s

regions_transformer(self.view, f)
regions_transformer(self.view, f)

0 comments on commit 232e549

Please sign in to comment.