From f8961a182cb023d941e6a241ee70e316aa8b2617 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Fri, 10 Dec 2021 12:05:02 -0500 Subject: Added append after, help menu, and listed commands --- src/filebuffer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/filebuffer.java') diff --git a/src/filebuffer.java b/src/filebuffer.java index 833f695..7ee27c2 100644 --- a/src/filebuffer.java +++ b/src/filebuffer.java @@ -121,7 +121,7 @@ public class filebuffer { /* deleteLine: deletes line in the range of start to stop */ public void deleteLine(int start, int stop) { for (int i = start; i < stop; i++) { - jed.file.buffer.remove(start); + buffer.remove(start); } } @@ -161,10 +161,14 @@ public class filebuffer { buffer.remove(currentLine); } - /* append: appends user input to the end of a file */ - public void append(Scanner kbIn) { + /* append: appends user input to the end of a file or after the current line */ + public void append(Scanner kbIn, boolean after) { String input; + int line = currentLine + 1; while (!(input = kbIn.nextLine()).equals(".")) - buffer.add(input); + if (after) + buffer.add(line++, input); + else + buffer.add(input); } } \ No newline at end of file -- cgit v1.2.3