Skip to content

Commit

Permalink
fixes sublimehq#101: (r<char>) process selection lines individually s…
Browse files Browse the repository at this point in the history
…o as to preserve newlines
  • Loading branch information
guillermooo committed Mar 28, 2012
1 parent c055d2b commit eff512f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vintage.py
Expand Up @@ -946,8 +946,12 @@ def run(self, edit, character):
# Vim replaces characters with unprintable ones when r<enter> is
# pressed from visual mode. Let's not make a replacement in
# that case.
if character != "\n":
self.view.replace(edit, s, character * len(s))
if character != '\n':
# Process lines contained in the selection individually.
# This way we preserve newline characters.
lines = self.view.split_by_newlines(s)
for line in lines:
self.view.replace(edit, line, character * line.size())
new_sel.append(sublime.Region(s.begin()))

self.view.sel().clear()
Expand Down

0 comments on commit eff512f

Please sign in to comment.