From 70c9ed402b830491af212717a89d02e63ee146f2 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 18 Aug 2006 18:27:04 +0000
Subject: [PATCH] Accept a simple parameter of a file to be edited, or a
 message to quote. If the filename parameter ents with (case-insensitive)
 "quotes.txt" or "input.msg", the test should be handled by the quoter.  If
 not, the text should be loaded as the message text.

This allows the ;edit function to work "perfectly" while not mucking up the
quoting stuff.

Fix bug when quoting last line of quote text.
---
 exec/fseditor.js | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/exec/fseditor.js b/exec/fseditor.js
index 8df69ddae5..fefeac1972 100644
--- a/exec/fseditor.js
+++ b/exec/fseditor.js
@@ -1224,7 +1224,7 @@ function quote_mode()
 				}
 				break;
 			case '\x0d':	/* CR */
-				for(i=0; i<quote_line.length-1; i++) {
+				for(i=0; i<quote_line.length; i++) {
 					if(quote_line[i].selected) {
 						line.splice(ypos,0,quote_line[i]);
 						ypos++;
@@ -1741,6 +1741,7 @@ function edit(quote_first)
 }
 
 var old_status=bbs.sys_status;
+var input_filename=system.node_dir+"QUOTES.TXT";
 bbs.sys_status&=~SS_PAUSEON;
 bbs.sys_status|=SS_PAUSEOFF;
 var oldpass=console.ctrlkey_passthru;
@@ -1748,14 +1749,23 @@ console.ctrlkey_passthru="+ACGKLOPQRUVWXYZ_";
 /* Enable delete line in SyncTERM (Disabling ANSI Music in the process) */
 console.write("\033[=1M");
 console.clear();
-var f=new File(system.node_dir+"QUOTES.TXT");
+if(argc==1)
+	input_filename=argv[0];
+var f=new File(input_filename);
 line.push(new Line());
 if(f.open("r",false)) {
-	quote_line=make_lines(quote_msg(word_wrap(f.read(),76)),'');
 	ypos=0;
-	edit(true);
+	if(input_filename.search(/(quotes.msg|input.msg)$/i) != -1) {
+		quote_line=make_lines(quote_msg(word_wrap(f.read(),76)),'');
+		edit(true);
+	}
+	else {
+		line=make_lines(word_wrap(f.read()),'');
+		edit(false);
+	}
 }
 else
 	edit(false);
 console.ctrlkey_passthru=oldpass;
 bbs.sys_status=old_status;
+
-- 
GitLab