for (i=0; i<newrows; i++) {
line = smalloc(TSIZE * (newcols+1));
for (j = 0; j <= newcols; j++)
- line[i] = erase_char;
+ line[j] = erase_char;
addpos234(newalt, line, i);
}
if (alt_screen) {
* Scroll the screen. (`lines' is +ve for scrolling forward, -ve
* for backward.) `sb' is TRUE if the scrolling is permitted to
* affect the scrollback buffer.
+ *
+ * NB this function invalidates all pointers into lines of the
+ * screen data structures. In particular, you MUST call fix_cpos
+ * after calling scroll() and before doing anything else that
+ * uses the cpos shortcut pointer.
*/
static void scroll (int topline, int botline, int lines, int sb) {
unsigned long *line, *line2;
int i;
- if (topline != 0)
+ if (topline != 0 || alt_which != 0)
sb = FALSE;
if (lines < 0) {
compatibility(VT102);
if (curs.y <= marg_b)
scroll (curs.y, marg_b, -def(esc_args[0], 1), FALSE);
+ fix_cpos;
seen_disp_event = TRUE;
break;
case 'M': /* delete lines */
compatibility(VT102);
if (curs.y <= marg_b)
scroll (curs.y, marg_b, def(esc_args[0], 1), TRUE);
+ fix_cpos;
seen_disp_event = TRUE;
break;
case '@': /* insert chars */
} else {
selstart = selanchor;
selend = selpoint;
- incpos(selpoint);
+ incpos(selend);
}
sel_spread();
} else if ((b == MB_SELECT || b == MB_EXTEND) && a == MA_RELEASE) {