}
skip: ;
}
+ last_row = row;
#endif /* FEATURE_VI_OPTIMIZE_CURSOR */
write1(cm);
- last_row = row;
}
//----- Erase from cursor to end of line -----------------------
int ofs = offset;
char *dest = scr_out_buf; // [MAX_SCR_COLS + MAX_TABSTOP * 2]
- memset(dest, ' ', MAX_SCR_COLS + MAX_TABSTOP * 2);
-
c = '~'; // char in col 0 in non-existent lines is '~'
- for (co = 0; co < columns + MAX_TABSTOP; co++) {
+ co = 0;
+ while (co < columns + tabstop) {
// have we gone past the end?
if (src < end) {
c = *src++;
}
}
}
- dest[co] = c;
+ dest[co++] = c;
// discard scrolled-off-to-the-left portion,
// in tabstop-sized pieces
if (ofs >= tabstop && co >= tabstop) {
- memmove(dest, dest + tabstop, co + 1);
+ memmove(dest, dest + tabstop, co);
co -= tabstop;
ofs -= tabstop;
}
}
// check "short line, gigantic offset" case
if (co < ofs)
- ofs = co + 1;
- dest[ofs + MAX_SCR_COLS] = '\0';
- return &dest[ofs];
+ ofs = co;
+ // discard last scrolled off part
+ co -= ofs;
+ dest += ofs;
+ // fill the rest with spaces
+ if (co < columns)
+ memset(&dest[co], ' ', columns - co);
+ return dest;
}
//----- Refresh the changed screen lines -----------------------