tRefuse to move to a non-existent screen location (default to 0,0). Don't bother moving the cursor position every time information is written to the screen buffer - just update it when refresh() is called. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 92d42d07ec56b85a978130f527a091ed40106a03
 (DIR) parent 88b462fb366969ddcb78b437c260d0c6dd4d5ff8
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Wed,  5 Feb 2003 15:56:35 +0000
       
       Refuse to move to a non-existent screen location (default to 0,0). Don't
       bother moving the cursor position every time information is written to
       tthe screen buffer - just update it when refresh() is called.
       
       
       Diffstat:
         M src/cursesport/cursesport.c         |      10 ++++++++--
       
       1 file changed, 8 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cursesport/cursesport.c b/src/cursesport/cursesport.c
       t@@ -44,6 +44,7 @@ void refresh(void)
          COORD size, offset;
          SMALL_RECT screenpos;
        
       +  move(CurY, CurX);
          for (y = 0; y < Depth; y++) {
            if (memcmp(&RealScreen[y][0], &VirtualScreen[y][0],
                       sizeof(CHAR_INFO) * Width) != 0) {
       t@@ -91,6 +92,7 @@ SCREEN *newterm(void *a, void *b, void *c)
          hOut = GetConHandle("CONOUT$");
          hIn = GetConHandle("CONIN$");
          SetConsoleMode(hIn, 0);
       +  SetConsoleMode(hOut, 0);
          return NULL;
        }
        
       t@@ -153,7 +155,6 @@ void curs_set(BOOL visible)
        {
          CONSOLE_CURSOR_INFO ConCurInfo;
        
       -  move(CurY, CurX);
          ConCurInfo.dwSize = 10;
          ConCurInfo.bVisible = visible;
          SetConsoleCursorInfo(hOut, &ConCurInfo);
       t@@ -170,6 +171,12 @@ void move(int y, int x)
        {
          COORD coord;
        
       +  if (x >= Width) {
       +    x = 0;
       +  }
       +  if (y >= Depth) {
       +    y = 0;
       +  }
          CurX = x;
          CurY = y;
          coord.X = x;
       t@@ -188,7 +195,6 @@ void addstr(const char *str)
        
          for (i = 0; i < strlen(str); i++)
            addch(str[i]);
       -  move(CurY, CurX);
        }
        
        void addch(int ch)