Kernel/VTerm - Implimented cursor save/restore
authorJohn Hodge (sonata) <[email protected]>
Mon, 27 May 2013 11:53:47 +0000 (19:53 +0800)
committerJohn Hodge (sonata) <[email protected]>
Mon, 27 May 2013 11:53:47 +0000 (19:53 +0800)
KernelLand/Kernel/drv/vterm.h
KernelLand/Kernel/drv/vterm_vt100.c

index 39cc438..5acb464 100644 (file)
@@ -62,6 +62,7 @@ struct sVTerm
         int    AltWritePos;    //!< Alternate write position
        short   ScrollTop;      //!< Top of scrolling region (smallest)
        short   ScrollHeight;   //!< Length of scrolling region
+        int    SavedWritePos;  //!< Saved cursor position (\e[s and \e[u)
 
        char    EscapeCodeCache[16];
        size_t  EscapeCodeLen;
index 1f34479..8ebd9bf 100644 (file)
@@ -228,7 +228,19 @@ void VT_int_ParseEscape_StandardLarge(tVTerm *Term, char CmdChar, int argc, int
                Term->ScrollTop = args[0];
                Term->ScrollHeight = args[1] - args[0];
                break;
-       
+
+       // Save cursor position
+       case 's':
+               if( argc != 0 ) break;
+               Term->SavedWritePos = (Term->Flags & VT_FLAG_ALTBUF) ? Term->AltWritePos : Term->WritePos;
+               break;
+
+       // Restore saved cursor position
+       case 'u':
+               if( argc != 0 ) break;
+               *((Term->Flags & VT_FLAG_ALTBUF) ? &Term->AltWritePos : &Term->WritePos) = Term->SavedWritePos;
+               break;
+
        default:
                Log_Warning("VTerm", "Unknown control sequence '\\x1B[%c'", CmdChar);
                break;

UCC git Repository :: git.ucc.asn.au