Add comments to broken code

This commit is contained in:
Mike Cifelli 2017-03-19 17:32:44 -04:00
parent ad173d06a9
commit cef7be6c25
1 changed files with 14 additions and 4 deletions

View File

@ -26,6 +26,7 @@ public class LispTerminal {
private boolean isFinished;
public LispTerminal(IOSafeTerminal terminal, PipedOutputStream inputWriter, PipedInputStream outputReader) {
// FIXME - add resize handler
this.terminal = terminal;
this.inputWriter = inputWriter;
this.outputReader = outputReader;
@ -136,11 +137,9 @@ public class LispTerminal {
if (isAtStartOfRow(cursorPosition))
newPosition = cursorPosition.withColumn(terminal.getTerminalSize().getColumns()).withRelativeRow(-1);
terminal.setCursorPosition(newPosition);
if (distanceFromOrigin(newPosition) == inputLine.length())
leadingEdge = terminal.getCursorPosition();
}
private boolean isAtStartOfRow(TerminalPosition cursorPosition) {
@ -163,9 +162,10 @@ public class LispTerminal {
moveCursorToNextRow(cursorPosition);
else
terminal.setCursorPosition(cursorPosition.withRelativeColumn(1));
TerminalPosition newPosition = terminal.getCursorPosition();
// FIXME - use distance from origin to set leading edge
if (distanceFromOrigin(newPosition) == inputLine.length())
leadingEdge = terminal.getCursorPosition();
}
@ -225,6 +225,10 @@ public class LispTerminal {
terminal.putCharacter(' ');
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.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 = 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())
terminal.putCharacter(c);