summaryrefslogtreecommitdiff
path: root/src/entry_backend/pango.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry_backend/pango.c')
-rw-r--r--src/entry_backend/pango.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c
index 34bb05e..13e21ee 100644
--- a/src/entry_backend/pango.c
+++ b/src/entry_backend/pango.c
@@ -72,12 +72,31 @@ void entry_backend_pango_update(struct entry *entry)
pango_layout_get_size(layout, &width, &height);
width = MAX(width, (int)entry->input_width * PANGO_SCALE);
- for (size_t i = 0; i < entry->num_results && i < entry->results.count; i++) {
+ cairo_matrix_t mat;
+ for (size_t i = 0; i < entry->results.count; i++) {
if (entry->horizontal) {
cairo_translate(cr, (int)(width / PANGO_SCALE) + entry->result_spacing, 0);
} else {
cairo_translate(cr, 0, (int)(height / PANGO_SCALE) + entry->result_spacing);
}
+ if (entry->num_results == 0) {
+ cairo_get_matrix(cr, &mat);
+ if (entry->horizontal) {
+ if (mat.x0 > entry->clip_x + entry->clip_width) {
+ entry->num_results_drawn = i;
+ log_debug("Drew %zu results.\n", i);
+ break;
+ }
+ } else {
+ if (mat.y0 > entry->clip_y + entry->clip_height) {
+ entry->num_results_drawn = i;
+ log_debug("Drew %zu results.\n", i);
+ break;
+ }
+ }
+ } else if (i >= entry->num_results) {
+ break;
+ }
const char *str;
if (i < entry->results.count) {
str = entry->results.buf[i].string;