VintageBigBlue.org

 
Nov 12, 2018

<esc>D does not cause terminal to scroll

There are a lot of nasty details about ANSI escape codes that are not given in most of the tables on
the internet.  One of them is getting a window to scroll with escD.  Wether you use the default 
entire window or you use esc[30;40r to define a sub-window for scrolling to take place you must have
the cursor located at the bottom line of the scrolling window.  If the cursor is not on the bottom
line of the scroll window the <esc>D command will cause the cursor to drop down a line.  In java
this works (I have tested it).

            try { 
                telnetOut.write("\033c\033 L\033[2J\033[H".getBytes()) ;
                for (int i=0;i<38;i++) {
                    String spcs = "" ;
                    while (spcs.length() < i+1) spcs = " " + spcs ;
                    telnetOut.write((spcs + i + "\n").getBytes()) ;
                }
                telnetOut.write("\033[30;40r".getBytes()) ;
                HercTUI.tnClient.telnetOut.write("\033[40;1f".getBytes()) ;
                for (int i=0;i<10;i++) {
                    String spcs = "" ;
                    while (spcs.length() < i*2) spcs = " * " + spcs ;
                    telnetOut.write((spcs + i + spcs + "We're scrolling now boys!\r").getBytes()) ;
                                    telnetOut.write("\033D".getBytes()) ;
                                    sleep(2100) ;
                }
              } catch (Exception e) {}


Contact Us
This Site's Privacy Policy
Google's privacy policies