Commit 894ed485745c00ed1dd9274c047c00c6758b4a3d
1 parent
8727f445
git-svn-id: svn://imanolbarba.net/PAD@18 c2ee353e-ed0d-4329-bf56-03aec153487f
Showing
16 changed files
with
64 additions
and
7 deletions
JChat/.classpath
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<classpath> | ||
3 | + <classpathentry kind="src" path="src"/> | ||
4 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
5 | + <classpathentry kind="output" path="bin"/> | ||
6 | +</classpath> |
JChat/.project
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<projectDescription> | ||
3 | + <name>JChat</name> | ||
4 | + <comment></comment> | ||
5 | + <projects> | ||
6 | + </projects> | ||
7 | + <buildSpec> | ||
8 | + <buildCommand> | ||
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | + <arguments> | ||
11 | + </arguments> | ||
12 | + </buildCommand> | ||
13 | + </buildSpec> | ||
14 | + <natures> | ||
15 | + <nature>org.eclipse.jdt.core.javanature</nature> | ||
16 | + </natures> | ||
17 | +</projectDescription> |
JChat/.settings/org.eclipse.jdt.core.prefs
0 → 100644
1 | +eclipse.preferences.version=1 | ||
2 | +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
3 | +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
4 | +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
5 | +org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | +org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
7 | +org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
8 | +org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
9 | +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
10 | +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
11 | +org.eclipse.jdt.core.compiler.source=1.6 |
JChat/bin/pad/prac2/MyServerSocket.class
0 → 100644
No preview for this file type
JChat/bin/pad/prac2/MySocket.class
0 → 100644
No preview for this file type
JChat/src/pad/prac2/MyServerSocket.java
0 → 100644
JChat/src/pad/prac2/MySocket.java
0 → 100644
readline/bin/pad/prac1/Command.class
No preview for this file type
readline/bin/pad/prac1/Console.class
No preview for this file type
readline/bin/pad/prac1/Coordinate.class
No preview for this file type
readline/bin/pad/prac1/EditableBufferedReader.class
No preview for this file type
readline/bin/pad/prac1/Line.class
No preview for this file type
readline/src/pad/prac1/Console.java
@@ -22,7 +22,7 @@ public class Console implements Observer | @@ -22,7 +22,7 @@ public class Console implements Observer | ||
22 | updateCurrentPos(); | 22 | updateCurrentPos(); |
23 | if(pos > currentPos) | 23 | if(pos > currentPos) |
24 | { | 24 | { |
25 | - while((pos-currentPos) >= numCols) | 25 | + while((currentXY.x()+(pos-currentPos)) > numCols) |
26 | { | 26 | { |
27 | currentPos += numCols - currentXY.x()+1; | 27 | currentPos += numCols - currentXY.x()+1; |
28 | System.out.print((char)EditableBufferedReader.ESC); | 28 | System.out.print((char)EditableBufferedReader.ESC); |
@@ -45,9 +45,6 @@ public class Console implements Observer | @@ -45,9 +45,6 @@ public class Console implements Observer | ||
45 | } | 45 | } |
46 | else if(pos < currentPos) | 46 | else if(pos < currentPos) |
47 | { | 47 | { |
48 | - System.err.println(currentPos); | ||
49 | - System.err.println(pos); | ||
50 | - System.err.println(currentXY); | ||
51 | while((currentPos-pos) >= currentXY.x()) | 48 | while((currentPos-pos) >= currentXY.x()) |
52 | { | 49 | { |
53 | currentPos -= currentXY.x(); | 50 | currentPos -= currentXY.x(); |
readline/src/pad/prac1/EditableBufferedReader.java
@@ -140,9 +140,10 @@ public class EditableBufferedReader extends BufferedReader | @@ -140,9 +140,10 @@ public class EditableBufferedReader extends BufferedReader | ||
140 | break; | 140 | break; |
141 | 141 | ||
142 | case EOF: | 142 | case EOF: |
143 | - case RETURN_KEY: | ||
144 | endOfFile = true; | 143 | endOfFile = true; |
145 | break; | 144 | break; |
145 | + | ||
146 | + case RETURN_KEY: | ||
146 | default: | 147 | default: |
147 | line.addChar((char)character); | 148 | line.addChar((char)character); |
148 | break; | 149 | break; |
readline/src/pad/prac1/Line.java
@@ -86,9 +86,13 @@ public class Line extends Observable | @@ -86,9 +86,13 @@ public class Line extends Observable | ||
86 | 86 | ||
87 | public void addChar(char c) | 87 | public void addChar(char c) |
88 | { | 88 | { |
89 | - if(c == EditableBufferedReader.LINE_FEED) | 89 | + if(c == EditableBufferedReader.RETURN_KEY) |
90 | { | 90 | { |
91 | + insertCharAt((char)EditableBufferedReader.LINE_FEED,cursorPosition-1); | ||
92 | + sendCommand(Command.INSERT_CHAR,EditableBufferedReader.LINE_FEED); | ||
91 | sendCommand(Command.INSERT_CHAR,EditableBufferedReader.RETURN_KEY); | 93 | sendCommand(Command.INSERT_CHAR,EditableBufferedReader.RETURN_KEY); |
94 | + cursorPosition++; | ||
95 | + return; | ||
92 | } | 96 | } |
93 | switch(writeMode) | 97 | switch(writeMode) |
94 | { | 98 | { |
readline/src/pad/prac1/MainClass.java
@@ -12,5 +12,15 @@ public class MainClass | @@ -12,5 +12,15 @@ public class MainClass | ||
12 | System.out.println("\nLine read: \n" + editable.readLine()); | 12 | System.out.println("\nLine read: \n" + editable.readLine()); |
13 | editable.close(); | 13 | editable.close(); |
14 | } | 14 | } |
15 | - | ||
16 | } | 15 | } |
16 | + | ||
17 | +/* | ||
18 | + * TODO | ||
19 | + * DETECT LINE LENGTH BEFORE PASSING ARGS TO LINE.SETCURSOR | ||
20 | + * UP/DOWN cursor | ||
21 | + * PGUP/PGDN | ||
22 | + * INSERT NEWLINE IN A STRING (SPLITTING STRINGS) | ||
23 | + * MOUSE SUPPORT | ||
24 | + * FORM SUPPORT | ||
25 | + */ | ||
26 | + |