diff --git a/readline/bin/pad/prac1/Console.class b/readline/bin/pad/prac1/Console.class index 8af3d5d..558a08c 100644 --- a/readline/bin/pad/prac1/Console.class +++ b/readline/bin/pad/prac1/Console.class diff --git a/readline/bin/pad/prac1/EditableBufferedReader.class b/readline/bin/pad/prac1/EditableBufferedReader.class index c6186cb..1ecdac0 100644 --- a/readline/bin/pad/prac1/EditableBufferedReader.class +++ b/readline/bin/pad/prac1/EditableBufferedReader.class diff --git a/readline/bin/pad/prac1/Line.class b/readline/bin/pad/prac1/Line.class index 4597b83..3de6175 100644 --- a/readline/bin/pad/prac1/Line.class +++ b/readline/bin/pad/prac1/Line.class diff --git a/readline/src/pad/prac1/Console.java b/readline/src/pad/prac1/Console.java index 1f5a848..0f91be3 100644 --- a/readline/src/pad/prac1/Console.java +++ b/readline/src/pad/prac1/Console.java @@ -27,7 +27,7 @@ public class Console implements Observer scanner.findWithinHorizon(pattern,0); numCols = Integer.parseInt(scanner.match().group(2)); numRows = Integer.parseInt(scanner.match().group(1)); - scanner.close(); + System.err.println("TERMSIZE:" + numCols + " " + numRows); } public Coordinate getCurrentPos() @@ -40,7 +40,7 @@ public class Console implements Observer scanner.findWithinHorizon(pattern,0); int x = Integer.parseInt(scanner.match().group(2)); int y = Integer.parseInt(scanner.match().group(1)); - scanner.close(); + System.err.println("POS:" + x + " " + y); return new Coordinate(x,y); } diff --git a/readline/src/pad/prac1/EditableBufferedReader.java b/readline/src/pad/prac1/EditableBufferedReader.java index b0d2d99..7f0e238 100644 --- a/readline/src/pad/prac1/EditableBufferedReader.java +++ b/readline/src/pad/prac1/EditableBufferedReader.java @@ -108,7 +108,6 @@ public class EditableBufferedReader extends BufferedReader line.toggleMode(); break; } - scanner.close(); return; } else if(scanner.findWithinHorizon("O?", 0).length() > 0) @@ -125,10 +124,8 @@ public class EditableBufferedReader extends BufferedReader line.setCursorTo(line.length()+1); break; } - scanner.close(); return; } - scanner.close(); } else { @@ -150,7 +147,6 @@ public class EditableBufferedReader extends BufferedReader line.addChar((char)character); break; } - scanner.close(); return; } } @@ -180,6 +176,7 @@ public class EditableBufferedReader extends BufferedReader } catch(Exception e) { + e.printStackTrace(); System.out.println("Error reading line"); return ""; } diff --git a/readline/src/pad/prac1/Line.java b/readline/src/pad/prac1/Line.java index 70b7f31..117e4b7 100644 --- a/readline/src/pad/prac1/Line.java +++ b/readline/src/pad/prac1/Line.java @@ -106,6 +106,7 @@ public class Line extends Observable if(cursorPosition != line.length()+1) { removeCharAt(cursorPosition-1); + sendCommand(Command.DELETE_CHAR); } sendCommand(Command.INSERT_CHAR,(int)c); insertCharAt(c, cursorPosition-1); diff --git a/readline/src/pad/prac1/MainClass.java b/readline/src/pad/prac1/MainClass.java index cef2bb8..f3e25d9 100644 --- a/readline/src/pad/prac1/MainClass.java +++ b/readline/src/pad/prac1/MainClass.java @@ -21,4 +21,5 @@ public class MainClass * * TO-FIX * Cursor keys, Home and end keys when new line, reset line length + * SPEED */ \ No newline at end of file