code: function gli_window_grid_canonicalize(win) {
      if (win.cursorx < 0)
          win.cursorx = 0;
      else if (win.cursorx >= win.gridwidth) {
          win.cursorx = 0;
          win.cursory++;
      }
      if (win.cursory < 0)
          win.cursory = 0;
      else if (win.cursory >= win.gridheight)
          return true; /* outside the window */
      return false;
  }
docs: /* Canonicalize the cursor position. That is, the cursor may have
  been left outside the window area; wrap it if necessary.
  
  Returns true if the cursor winds up wrapped outside the window entirely;
  false if the cursor winds up at a legal printing position.