summaryrefslogtreecommitdiff
path: root/src/filebuffer.java
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@simplelittledream.com>2021-12-10 12:05:02 -0500
committerJacob McDonnell <jacob@simplelittledream.com>2021-12-10 12:05:02 -0500
commitf8961a182cb023d941e6a241ee70e316aa8b2617 (patch)
tree81cc19b70acc225cbd2203300158239fe4a86972 /src/filebuffer.java
parent4fd05739633d1699992a833d59a9e102017e545f (diff)
Added append after, help menu, and listed commands
Diffstat (limited to 'src/filebuffer.java')
-rw-r--r--src/filebuffer.java12
1 files changed, 8 insertions, 4 deletions
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