From dd75b5eeccccbedc8b18bc4a472c51fb5dca55b3 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Mon, 11 Nov 2013 02:41:15 +0000 Subject: [PATCH] git-svn-id: svn://imanolbarba.net/PAD@15 c2ee353e-ed0d-4329-bf56-03aec153487f --- readline/bin/pad/prac1/Console.class | Bin 3180 -> 0 bytes readline/bin/pad/prac1/EditableBufferedReader.class | Bin 4174 -> 0 bytes readline/bin/pad/prac1/Line.class | Bin 2982 -> 0 bytes readline/src/pad/prac1/Console.java | 4 ++-- readline/src/pad/prac1/EditableBufferedReader.java | 5 +---- readline/src/pad/prac1/Line.java | 1 + readline/src/pad/prac1/MainClass.java | 1 + 7 files changed, 5 insertions(+), 6 deletions(-) diff --git a/readline/bin/pad/prac1/Console.class b/readline/bin/pad/prac1/Console.class index 8af3d5d..558a08c 100644 Binary files a/readline/bin/pad/prac1/Console.class and b/readline/bin/pad/prac1/Console.class differ diff --git a/readline/bin/pad/prac1/EditableBufferedReader.class b/readline/bin/pad/prac1/EditableBufferedReader.class index c6186cb..1ecdac0 100644 Binary files a/readline/bin/pad/prac1/EditableBufferedReader.class and b/readline/bin/pad/prac1/EditableBufferedReader.class differ diff --git a/readline/bin/pad/prac1/Line.class b/readline/bin/pad/prac1/Line.class index 4597b83..3de6175 100644 Binary files a/readline/bin/pad/prac1/Line.class and b/readline/bin/pad/prac1/Line.class differ 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 -- libgit2 0.22.2