diff --git a/JChat/.classpath b/JChat/.classpath new file mode 100644 index 0000000..18d70f0 --- /dev/null +++ b/JChat/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/JChat/.project b/JChat/.project new file mode 100644 index 0000000..f3795fe --- /dev/null +++ b/JChat/.project @@ -0,0 +1,17 @@ + + + JChat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/JChat/.settings/org.eclipse.jdt.core.prefs b/JChat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8000cd6 --- /dev/null +++ b/JChat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/JChat/bin/pad/prac2/MyServerSocket.class b/JChat/bin/pad/prac2/MyServerSocket.class new file mode 100644 index 0000000..ea4047a --- /dev/null +++ b/JChat/bin/pad/prac2/MyServerSocket.class diff --git a/JChat/bin/pad/prac2/MySocket.class b/JChat/bin/pad/prac2/MySocket.class new file mode 100644 index 0000000..efe075a --- /dev/null +++ b/JChat/bin/pad/prac2/MySocket.class diff --git a/JChat/src/pad/prac2/MyServerSocket.java b/JChat/src/pad/prac2/MyServerSocket.java new file mode 100644 index 0000000..0f6a2fe --- /dev/null +++ b/JChat/src/pad/prac2/MyServerSocket.java @@ -0,0 +1,5 @@ +package pad.prac2; + +public class MyServerSocket { + +} diff --git a/JChat/src/pad/prac2/MySocket.java b/JChat/src/pad/prac2/MySocket.java new file mode 100644 index 0000000..920a8f2 --- /dev/null +++ b/JChat/src/pad/prac2/MySocket.java @@ -0,0 +1,6 @@ +package pad.prac2; + +public class MySocket +{ + +} diff --git a/readline/bin/pad/prac1/Command.class b/readline/bin/pad/prac1/Command.class index 5e6a22b..5c8b189 100644 --- a/readline/bin/pad/prac1/Command.class +++ b/readline/bin/pad/prac1/Command.class diff --git a/readline/bin/pad/prac1/Console.class b/readline/bin/pad/prac1/Console.class index 0fd5a29..1877ab4 100644 --- a/readline/bin/pad/prac1/Console.class +++ b/readline/bin/pad/prac1/Console.class diff --git a/readline/bin/pad/prac1/Coordinate.class b/readline/bin/pad/prac1/Coordinate.class index 21285e1..2cf1281 100644 --- a/readline/bin/pad/prac1/Coordinate.class +++ b/readline/bin/pad/prac1/Coordinate.class diff --git a/readline/bin/pad/prac1/EditableBufferedReader.class b/readline/bin/pad/prac1/EditableBufferedReader.class index 1ecdac0..9ad8ed1 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 3de6175..58b6231 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 feec07f..fd91168 100644 --- a/readline/src/pad/prac1/Console.java +++ b/readline/src/pad/prac1/Console.java @@ -22,7 +22,7 @@ public class Console implements Observer updateCurrentPos(); if(pos > currentPos) { - while((pos-currentPos) >= numCols) + while((currentXY.x()+(pos-currentPos)) > numCols) { currentPos += numCols - currentXY.x()+1; System.out.print((char)EditableBufferedReader.ESC); @@ -45,9 +45,6 @@ public class Console implements Observer } else if(pos < currentPos) { - System.err.println(currentPos); - System.err.println(pos); - System.err.println(currentXY); while((currentPos-pos) >= currentXY.x()) { currentPos -= currentXY.x(); diff --git a/readline/src/pad/prac1/EditableBufferedReader.java b/readline/src/pad/prac1/EditableBufferedReader.java index 3fcfe08..2d57b1e 100644 --- a/readline/src/pad/prac1/EditableBufferedReader.java +++ b/readline/src/pad/prac1/EditableBufferedReader.java @@ -140,9 +140,10 @@ public class EditableBufferedReader extends BufferedReader break; case EOF: - case RETURN_KEY: endOfFile = true; break; + + case RETURN_KEY: default: line.addChar((char)character); break; diff --git a/readline/src/pad/prac1/Line.java b/readline/src/pad/prac1/Line.java index 797baa8..e58f9d9 100644 --- a/readline/src/pad/prac1/Line.java +++ b/readline/src/pad/prac1/Line.java @@ -86,9 +86,13 @@ public class Line extends Observable public void addChar(char c) { - if(c == EditableBufferedReader.LINE_FEED) + if(c == EditableBufferedReader.RETURN_KEY) { + insertCharAt((char)EditableBufferedReader.LINE_FEED,cursorPosition-1); + sendCommand(Command.INSERT_CHAR,EditableBufferedReader.LINE_FEED); sendCommand(Command.INSERT_CHAR,EditableBufferedReader.RETURN_KEY); + cursorPosition++; + return; } switch(writeMode) { diff --git a/readline/src/pad/prac1/MainClass.java b/readline/src/pad/prac1/MainClass.java index 09ec8d6..73e4530 100644 --- a/readline/src/pad/prac1/MainClass.java +++ b/readline/src/pad/prac1/MainClass.java @@ -12,5 +12,15 @@ public class MainClass System.out.println("\nLine read: \n" + editable.readLine()); editable.close(); } - } + +/* + * TODO + * DETECT LINE LENGTH BEFORE PASSING ARGS TO LINE.SETCURSOR + * UP/DOWN cursor + * PGUP/PGDN + * INSERT NEWLINE IN A STRING (SPLITTING STRINGS) + * MOUSE SUPPORT + * FORM SUPPORT + */ +