From 85207f7ea374c8eb8fd578cbbde7782e836bfd78 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 24 Oct 2019 00:21:59 +0200
Subject: [PATCH] Fix paste-forward behavior at end of buffer.

---
 plomvi.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plomvi.el b/plomvi.el
index 28ede50..bda484d 100644
--- a/plomvi.el
+++ b/plomvi.el
@@ -128,14 +128,18 @@ Note that this ignores killed rectangles.
 (defun plomvi-paste-forward ()
   "Paste last kill rightwards in current line, or (if kill ends in \n) under it.
 
+Doesn't move rightwards before yanking if at end of buffer.
+
 Note that this ignores killed rectangles."
   (interactive)
   (if (eq nil (string-match "\n$" (current-kill 0)))
       (progn
-        (right-char)
+        (if (< (point) (point-max))
+            (right-char))
         (yank))
     (end-of-line)
-    (right-char)
+    (if (< (point) (point-max))
+        (right-char))
     (yank)
     (previous-line)))
 
-- 
2.30.2