Skip to content

Commit

Permalink
Fixed issue with console cursor getting misplaced if you back up on a…
Browse files Browse the repository at this point in the history
… multi-line input at the bottom of the screen.
  • Loading branch information
JoeStrout committed Jan 27, 2022
1 parent 66c65f4 commit 767c2e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions M1/Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public Console(Shell owner)
innerSrcR = new Rectangle(20, 18, 160, 120);

display = new TextDisplay();
display.onScrolled += NoteScrolled;
display.backColor = new Color(0.31f, 0.11f, 0.86f);
display.Clear();

Expand Down
9 changes: 7 additions & 2 deletions M1/TextDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public void Copy(Cell other) {
public float cursorOnTime = 0.7f;
public float cursorOffTime = 0.3f;
public string delimiter = "\n";


public Action onScrolled;

#endregion
//--------------------------------------------------------------------------------
#region Private Properties
Expand Down Expand Up @@ -163,16 +165,19 @@ public void Advance() {
}

public void Backup() {
int oldX = cursorX, oldY = cursorY;
HideCursorVisual();
cursorX--;
if (cursorX < 0) {
if (cursorY >= rows-1) {
cursorX = 0;
Debug.Log($"Backup1: was {oldX},{oldY} now {cursorX},{cursorY}");
return;
}
cursorY++;
cursorX = cols-1;
}
Debug.Log($"Backup2: was {oldX},{oldY} now {cursorX},{cursorY}");
}

public void Set(int row, int col, char c) {
Expand Down Expand Up @@ -222,7 +227,7 @@ public void Scroll() {
}
if (cursorY < rows-1) cursorY++;
ClearRow(0);
//if (onScrolled != null) onScrolled.Invoke();
if (onScrolled != null) onScrolled.Invoke();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ These will be addressed ASAP.
- If you leave a bot on top of a crop plant overnight, it will squash it (destroy the plant).
+ In the text/code editor, typing on the very last row of the screen causes visual errors until you hit return or scroll the text.
+ Some bot duplication glitch exists -- exact details still unclear, but it might be when accidentally hitting your bot while dismissing the bot dialog.
- The command line cursor gets misplaced if, at the bottom of the screen, you type a command longer than 40 characters (so that it wraps) and then back up with the left arrow key to the previous line.
+ The command line cursor gets misplaced if, at the bottom of the screen, you type a command longer than 40 characters (so that it wraps) and then back up with the left arrow key to the previous line.
- If you leave the farm while a bot is chopping down a tree or stump (with an axe), when you return it will be trying to use a scythe instead.

## Unscheduled Future Version
Expand Down

0 comments on commit 767c2e7

Please sign in to comment.