aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/de/mud/terminal/VDUBuffer.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/mud/terminal/VDUBuffer.java')
-rw-r--r--app/src/main/java/de/mud/terminal/VDUBuffer.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/java/de/mud/terminal/VDUBuffer.java b/app/src/main/java/de/mud/terminal/VDUBuffer.java
index 93e3ccf..f1d97ea 100644
--- a/app/src/main/java/de/mud/terminal/VDUBuffer.java
+++ b/app/src/main/java/de/mud/terminal/VDUBuffer.java
@@ -731,6 +731,7 @@ public class VDUBuffer {
char cbuf[][];
int abuf[][];
int maxSize = bufSize;
+ int oldAbsR = screenBase + getCursorRow();
if (w < 1 || h < 1) return;
@@ -778,14 +779,18 @@ public class VDUBuffer {
int C = getCursorColumn();
if (C < 0)
C = 0;
- else if (C >= width)
- C = width - 1;
+ else if (C >= w)
+ C = w - 1;
int R = getCursorRow();
+ // If the screen size has grown and now there are more rows on the screen,
+ // slide the cursor down to the end of the text.
+ if (R + screenBase <= oldAbsR)
+ R = oldAbsR - screenBase;
if (R < 0)
R = 0;
- else if (R >= height)
- R = height - 1;
+ else if (R >= h)
+ R = h - 1;
setCursorPosition(C, R);