Skip to content

Commit

Permalink
Fixed extra line issue when duplicating
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevgnen authored and bbatsov committed Aug 10, 2021
1 parent 95f5040 commit c3b6138
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crux.el
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ there's a region, all lines that region covers will be duplicated."
(region (buffer-substring-no-properties beg end)))
(dotimes (_i arg)
(goto-char end)
(newline)
(unless (use-region-p)
(newline))
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg))))
Expand All @@ -402,7 +403,8 @@ there's a region, all lines that region covers will be duplicated."
(setq end (line-end-position))
(dotimes (_ arg)
(goto-char end)
(newline)
(unless (use-region-p)
(newline))
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg))))
Expand Down

0 comments on commit c3b6138

Please sign in to comment.