scroll (marg_t, marg_b, 1, TRUE);
else if (curs_y < rows-1)
curs_y++;
+ if (cfg.lfhascr)
+ curs_x = 0;
fix_cpos;
wrapnext = FALSE;
disptop = scrtop;
}
break;
case 'r': /* set scroll margins */
- if (esc_nargs <= 2) {
+ if (!esc_query && esc_nargs <= 2) {
int top, bot;
top = def(esc_args[0], 1) - 1;
if (top < 0)
top = 0;
- bot = (esc_nargs == 1 ? rows :
+ bot = (esc_nargs <= 1 || esc_args[1] == 0 ? rows :
def(esc_args[1], rows)) - 1;
if (bot >= rows)
bot = rows-1;
right = (r - 1) / font_width;
top = t / font_height;
bottom = (b - 1) / font_height;
- for (i = top; i <= bottom && j<rows ; i++)
- for (j = left; j <= right && j<cols ; j++)
+ for (i = top; i <= bottom && i < rows ; i++)
+ for (j = left; j <= right && j < cols ; j++)
disptext[i*(cols+1)+j] = ATTR_INVALID;
do_paint (ctx, FALSE);
if (y<0) y = 0;
if (y>=rows) y = rows-1;
- if (x<0) x = 0;
+ if (x<0) {
+ if (y > 0) {
+ x = cols-1;
+ y--;
+ } else
+ x = 0;
+ }
if (x>=cols) x = cols-1;
selpoint = disptop + y * (cols+1) + x;