Skip to content

Commit 767c2e7

Browse files
committed
Fixed issue with console cursor getting misplaced if you back up on a multi-line input at the bottom of the screen.
1 parent 66c65f4 commit 767c2e7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

M1/Console.cs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public Console(Shell owner)
6969
innerSrcR = new Rectangle(20, 18, 160, 120);
7070

7171
display = new TextDisplay();
72+
display.onScrolled += NoteScrolled;
7273
display.backColor = new Color(0.31f, 0.11f, 0.86f);
7374
display.Clear();
7475

M1/TextDisplay.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public void Copy(Cell other) {
4848
public float cursorOnTime = 0.7f;
4949
public float cursorOffTime = 0.3f;
5050
public string delimiter = "\n";
51-
51+
52+
public Action onScrolled;
53+
5254
#endregion
5355
//--------------------------------------------------------------------------------
5456
#region Private Properties
@@ -163,16 +165,19 @@ public void Advance() {
163165
}
164166

165167
public void Backup() {
168+
int oldX = cursorX, oldY = cursorY;
166169
HideCursorVisual();
167170
cursorX--;
168171
if (cursorX < 0) {
169172
if (cursorY >= rows-1) {
170173
cursorX = 0;
174+
Debug.Log($"Backup1: was {oldX},{oldY} now {cursorX},{cursorY}");
171175
return;
172176
}
173177
cursorY++;
174178
cursorX = cols-1;
175179
}
180+
Debug.Log($"Backup2: was {oldX},{oldY} now {cursorX},{cursorY}");
176181
}
177182

178183
public void Set(int row, int col, char c) {
@@ -222,7 +227,7 @@ public void Scroll() {
222227
}
223228
if (cursorY < rows-1) cursorY++;
224229
ClearRow(0);
225-
//if (onScrolled != null) onScrolled.Invoke();
230+
if (onScrolled != null) onScrolled.Invoke();
226231
}
227232

228233
/// <summary>

ROADMAP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ These will be addressed ASAP.
4646
- If you leave a bot on top of a crop plant overnight, it will squash it (destroy the plant).
4747
+ 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.
4848
+ Some bot duplication glitch exists -- exact details still unclear, but it might be when accidentally hitting your bot while dismissing the bot dialog.
49-
- 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.
49+
+ 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.
5050
- 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.
5151

5252
## Unscheduled Future Version

0 commit comments

Comments
 (0)