From f44e9353a73b1e0acb5131de1e9896858f3d9feb 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 3fc313c..69960c8 100644 --- a/crux.el +++ b/crux.el @@ -382,7 +382,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)))) @@ -400,7 +401,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))))