From c3b61380caa115e1065cebbf5450f52459988f90 Mon Sep 17 00:00:00 2001 From: Yevgnen Koh Date: Sat, 20 Mar 2021 21:29:53 +0800 Subject: [PATCH] Fixed extra line issue when duplicating --- crux.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crux.el b/crux.el index d7654cf..a6ca1fa 100644 --- a/crux.el +++ b/crux.el @@ -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)))) @@ -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))))