shithub: nc

Download patch

ref: 7dd978d5bfd01aaa6f899714422275adeeb894ec
parent: a2cc344d7c9d5373c0bcc3d5d842ee299d159960
author: phil9 <telephil9@gmail.com>
date: Fri Dec 30 03:57:16 EST 2022

prevent copy to same directory

--- a/dirviewcmd.c
+++ b/dirviewcmd.c
@@ -74,6 +74,10 @@
 	
 	p = dirviewcurrentpanel(dview);
 	o = dirviewotherpanel(dview);
+	if(dirmodeleq(p->model, o->model)){
+		errormessage("cannot copy files to the same directory.", mc, kc);
+		return;
+	}
 	nd = dirlist(p, &d);
 	if(nd == 1)
 		snprint(buf, sizeof buf, "copy %s '%s' to '%s' ?",