From 2f58dfce133f60d49d9a1d0288ac1b582000497d Mon Sep 17 00:00:00 2001 From: sgerwk Date: Mon, 25 Jun 2018 10:47:51 +0200 Subject: [PATCH] when searching in a node, only search within its box --- src/viewer/text/search.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index a7197ef3..e07ae7cd 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -153,12 +153,13 @@ get_srch(struct document *document) foreachback (node, document->nodes) { int x, y; - int height = document->height; + int height = int_min(node->box.y + node->box.height, document->height); for (y = node->box.y; y < height; y++) { - int width = document->data[y].length; + int width = int_min(node->box.x + node->box.width, + document->data[y].length); - for (x = 0; + for (x = node->box.x; x < width && document->data[y].chars[x].data <= ' '; x++);