Add comments to broken code
This commit is contained in:
parent
ad173d06a9
commit
cef7be6c25
|
@ -26,6 +26,7 @@ public class LispTerminal {
|
||||||
private boolean isFinished;
|
private boolean isFinished;
|
||||||
|
|
||||||
public LispTerminal(IOSafeTerminal terminal, PipedOutputStream inputWriter, PipedInputStream outputReader) {
|
public LispTerminal(IOSafeTerminal terminal, PipedOutputStream inputWriter, PipedInputStream outputReader) {
|
||||||
|
// FIXME - add resize handler
|
||||||
this.terminal = terminal;
|
this.terminal = terminal;
|
||||||
this.inputWriter = inputWriter;
|
this.inputWriter = inputWriter;
|
||||||
this.outputReader = outputReader;
|
this.outputReader = outputReader;
|
||||||
|
@ -136,11 +137,9 @@ public class LispTerminal {
|
||||||
|
|
||||||
if (isAtStartOfRow(cursorPosition))
|
if (isAtStartOfRow(cursorPosition))
|
||||||
newPosition = cursorPosition.withColumn(terminal.getTerminalSize().getColumns()).withRelativeRow(-1);
|
newPosition = cursorPosition.withColumn(terminal.getTerminalSize().getColumns()).withRelativeRow(-1);
|
||||||
|
|
||||||
terminal.setCursorPosition(newPosition);
|
terminal.setCursorPosition(newPosition);
|
||||||
|
|
||||||
if (distanceFromOrigin(newPosition) == inputLine.length())
|
|
||||||
leadingEdge = terminal.getCursorPosition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAtStartOfRow(TerminalPosition cursorPosition) {
|
private boolean isAtStartOfRow(TerminalPosition cursorPosition) {
|
||||||
|
@ -163,9 +162,10 @@ public class LispTerminal {
|
||||||
moveCursorToNextRow(cursorPosition);
|
moveCursorToNextRow(cursorPosition);
|
||||||
else
|
else
|
||||||
terminal.setCursorPosition(cursorPosition.withRelativeColumn(1));
|
terminal.setCursorPosition(cursorPosition.withRelativeColumn(1));
|
||||||
|
|
||||||
TerminalPosition newPosition = terminal.getCursorPosition();
|
TerminalPosition newPosition = terminal.getCursorPosition();
|
||||||
|
|
||||||
|
// FIXME - use distance from origin to set leading edge
|
||||||
if (distanceFromOrigin(newPosition) == inputLine.length())
|
if (distanceFromOrigin(newPosition) == inputLine.length())
|
||||||
leadingEdge = terminal.getCursorPosition();
|
leadingEdge = terminal.getCursorPosition();
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,10 @@ public class LispTerminal {
|
||||||
terminal.putCharacter(' ');
|
terminal.putCharacter(' ');
|
||||||
|
|
||||||
retractCursor(cursorPosition);
|
retractCursor(cursorPosition);
|
||||||
|
|
||||||
|
// FIXME - use distance from origin to set leading edge
|
||||||
|
if (distanceFromOrigin(leadingEdge) > inputLine.length())
|
||||||
|
leadingEdge = terminal.getCursorPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +244,10 @@ public class LispTerminal {
|
||||||
|
|
||||||
terminal.putCharacter(' ');
|
terminal.putCharacter(' ');
|
||||||
terminal.setCursorPosition(cursorPosition);
|
terminal.setCursorPosition(cursorPosition);
|
||||||
|
|
||||||
|
// FIXME - use distance from origin to set leading edge
|
||||||
|
if (distanceFromOrigin(leadingEdge) > inputLine.length())
|
||||||
|
leadingEdge = terminal.getCursorPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +259,8 @@ public class LispTerminal {
|
||||||
+ inputLine.substring(distanceFromOrigin(cursorPosition), inputLine.length());
|
+ inputLine.substring(distanceFromOrigin(cursorPosition), inputLine.length());
|
||||||
inputLine = inputLine.substring(0, distanceFromOrigin(cursorPosition)) + remaining;
|
inputLine = inputLine.substring(0, distanceFromOrigin(cursorPosition)) + remaining;
|
||||||
|
|
||||||
|
// FIXME - must have a way to push remainder on to a new line at the end of the buffer
|
||||||
|
|
||||||
for (char c : remaining.toCharArray())
|
for (char c : remaining.toCharArray())
|
||||||
terminal.putCharacter(c);
|
terminal.putCharacter(c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue