From 9927436cc355eb09675bcd6dd026a984c6ba9309 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Thu, 13 Jan 2022 18:39:09 -0500 Subject: Added previous, next, and last line commands --- src/filebuffer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/filebuffer.java') diff --git a/src/filebuffer.java b/src/filebuffer.java index 7ee27c2..ff6b225 100644 --- a/src/filebuffer.java +++ b/src/filebuffer.java @@ -19,7 +19,6 @@ public class filebuffer { readFile(); } } - /* getFileSize: gets the size of the buffer arraylist */ public int getFileSize() { return buffer.size(); @@ -33,6 +32,12 @@ public class filebuffer { /* changeCurrentLine: changes the current line value */ public void changeCurrentLine(int n) { currentLine = n; + printLine(currentLine); + } + + /* printLine: prints the line */ + private void printLine(int n) { + System.out.printf("%d %s\n", n + 1, getLine(n)); } /* getLine: returns the selected line as a string */ -- cgit v1.2.3