tweaks: the starting point for painting /cannot/ be offscreen

The top_x variable has already been forced to become equal to from_x
if it was before it.  So start_col will be at least zero.
master
Benno Schulenberg 2017-01-08 12:36:51 +01:00
parent 5dbd288254
commit aa28441071
1 changed files with 0 additions and 8 deletions

View File

@ -2641,8 +2641,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* Only paint if the marked part of the line is on this page. */ /* Only paint if the marked part of the line is on this page. */
if (top_x < till_x && bot_x > from_x) { if (top_x < till_x && bot_x > from_x) {
assert(from_x <= top_x);
/* Compute on which screen column to start painting. */ /* Compute on which screen column to start painting. */
start_col = strnlenpt(fileptr->data, top_x) - from_col; start_col = strnlenpt(fileptr->data, top_x) - from_col;
@ -2656,12 +2654,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int
else else
paintlen = strnlenpt(fileptr->data, bot_x) - (start_col + from_col); paintlen = strnlenpt(fileptr->data, bot_x) - (start_col + from_col);
/* If painting starts before the beginning of the page, adjust. */
if (start_col < 0) {
paintlen += start_col;
start_col = 0;
}
index = actual_x(converted, start_col); index = actual_x(converted, start_col);
if (paintlen > 0) if (paintlen > 0)