diff --git a/config.def.h b/config.def.h
index 5b5a326..c41a376 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,12 +1,13 @@
/* settings */
-int default_width = 800;
-int default_height = 600;
-float zoom_step = 10;
-float zoom_min = 10;
-float zoom_max = 400;
-float scroll_step = 40;
-float transparency = 0.4;
-float smooth_scrolling = 0.0;
+int default_width = 800;
+int default_height = 600;
+float zoom_step = 10;
+float zoom_min = 10;
+float zoom_max = 400;
+float scroll_step = 40;
+float transparency = 0.4;
+float smooth_scrolling = 0.0;
+int n_completion_items = 15;
/* completion */
static const char FORMAT_COMMAND[] = "%s";
@@ -206,6 +207,7 @@ Setting settings[] = {
{"inputbar_fgcolor", &(inputbar_fgcolor), 's', FALSE, TRUE, "Inputbar foreground color"},
{"labels", &(Zathura.Global.enable_labelmode), 'b', FALSE, TRUE, "Allow label mode"},
{"list_printer_command", &(list_printer_command), 's', FALSE, FALSE, "Command to list printers"},
+ {"n_completion_items", &(n_completion_items), 'i', FALSE, FALSE, "Number of completion items"},
{"notification_e_bgcolor", &(notification_e_bgcolor), 's', FALSE, TRUE, "Notification (error) background color"},
{"notification_e_fgcolor", &(notification_e_fgcolor), 's', FALSE, TRUE, "Notification (error) foreground color"},
{"notification_w_bgcolor", &(notification_w_bgcolor), 's', FALSE, TRUE, "Notification (warning) background color"},
diff --git a/zathura.c b/zathura.c
index baf0a81..fd3e241 100644
--- a/zathura.c
+++ b/zathura.c
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include
#include
@@ -2478,6 +2479,21 @@ isc_completion(Argument* argument)
setCompletionRowColor(results, HIGHLIGHT, current_item);
+ /* hide other items */
+ int uh = ceil(n_completion_items / 2);
+ int lh = floor(n_completion_items / 2);
+
+ for(i = 0; i < n_items; i++)
+ {
+ if((i >= (current_item - lh) && (i <= current_item + uh)) ||
+ (i < n_completion_items && current_item < lh) ||
+ (i >= (n_items - n_completion_items) && (current_item >= (n_items - uh)))
+ )
+ gtk_widget_show(rows[i].row);
+ else
+ gtk_widget_hide(rows[i].row);
+ }
+
if(command_mode)
temp = g_strconcat(":", rows[current_item].command, NULL);
else