[OpenBIOS] [PATCHv2 16/20] terminal.fs: handle all cursor positioning within the terminal package.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun May 26 15:02:36 CEST 2013


Currently the column positioning is handled by the framebuffer code in
display.fs where it shouldn't really be. This also fixes a crash bug when
window-top is set and a line wraps onto the line beneath it.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/forth/device/display.fs  |   14 --------------
 openbios-devel/forth/device/terminal.fs |   23 +++++++++++++++++++----
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs
index 784de12..080087c 100644
--- a/openbios-devel/forth/device/display.fs
+++ b/openbios-devel/forth/device/display.fs
@@ -210,20 +210,6 @@ defer fb8-invertrect
     swap
   then
   fb8-blitmask
-  \ now advance the position
-  column# 1+
-  dup #columns = if
-    drop 0 to column#
-    line# 1+ 
-    dup #lines >= if
-      line#
-      0 to line#
-      1 delete-lines
-    then
-    to line#
-  else
-    to column#
-  then
   ;
 
 : fb8-reset-screen ( -- )
diff --git a/openbios-devel/forth/device/terminal.fs b/openbios-devel/forth/device/terminal.fs
index 82d3541..e41e973 100644
--- a/openbios-devel/forth/device/terminal.fs
+++ b/openbios-devel/forth/device/terminal.fs
@@ -229,13 +229,14 @@
     then
   endof
   a of \ LF
-    line# 1+ to line# 0 to column# 
+    line# 1+ to line# 
+    0 to column# 
     line# #lines >= if
-      line# 1-
       0 to line#
       1 delete-lines
-      to line#
-    then    
+      #lines 1- to line#      
+      toggle-cursor exit
+    then
   endof
   b of \ VT
     line# 0<> if
@@ -253,7 +254,21 @@
     1b (sequence) c!
     1 to (escseq)
   endof
+  
+  \ draw character and advance position
+  column# #columns >= if
+    0 to column#
+    line# 1+ to line#
+    line# #lines >= if
+      0 to line#
+      1 delete-lines
+      #lines 1- to line#
+    then
+  then
+  
   dup draw-character
+  column# 1+ to column#
+  
   endcase
   toggle-cursor
   ;
-- 
1.7.10.4




More information about the OpenBIOS mailing list