mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
[draw] inefficient colorization conditions
They must prevent drawing outside document area.
This commit is contained in:
parent
02aeda8bc1
commit
1171457eca
@ -441,12 +441,14 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
|||||||
int st = int_max(vx, 0);
|
int st = int_max(vx, 0);
|
||||||
int en = int_min(doc_view->document->data[y].length,
|
int en = int_min(doc_view->document->data[y].length,
|
||||||
box->width + vx);
|
box->width + vx);
|
||||||
int max = int_min(en, st + 200);
|
int max = int_min(en, doc_view->document->width);
|
||||||
|
|
||||||
if (en - st > 0) {
|
if (en - st > 0) {
|
||||||
draw_line(term, box->x + st - vx, box->y + y - vy,
|
if (st - vx >= 0) {
|
||||||
|
draw_line(term, box->x + st - vx, box->y + y - vy,
|
||||||
en - st,
|
en - st,
|
||||||
&doc_view->document->data[y].ch.chars[st]);
|
&doc_view->document->data[y].ch.chars[st]);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = en - 1; i >= 0; --i) {
|
for (i = en - 1; i >= 0; --i) {
|
||||||
if (doc_view->document->data[y].ch.chars[i].data != ' ') {
|
if (doc_view->document->data[y].ch.chars[i].data != ' ') {
|
||||||
@ -465,13 +467,15 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j = st; j < i; j++) {
|
for (j = st; j < i; j++) {
|
||||||
draw_space(term, box->x + j - vx, box->y + y - vy,
|
if (j - vx >= 0) {
|
||||||
first);
|
draw_space(term, box->x + j - vx, box->y + y - vy, first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = last_index; i < box->width + vx; i++) {
|
for (i = last_index; i < box->width + vx; i++) {
|
||||||
draw_space(term, box->x + i - vx, box->y + y - vy,
|
if (i - vx < box->width && i - vx >= 0) {
|
||||||
last);
|
draw_space(term, box->x + i - vx, box->y + y - vy, last);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user