GList *old, *new;
Completion *c;
- int length = g_list_length(completion);
- int max = 15;
- int items = MAX(length, max);
- int r = (max) % 2;
- int offset = max / 2 - 1 + r;
+ gint length = g_list_length(completion);
+ gint max = vp.config.max_completion_items;
+ gint items = MAX(length, max);
+ gint r = (max) % 2;
+ gint offset = max / 2 - 1 + r;
old = active;
int position = g_list_position(completion, active) + 1;
/* allow to chenge the direction of display */
static void completion_show(gboolean back)
{
- /* TODO make this configurable */
- const gint max_items = 15;
+ guint max = vp.config.max_completion_items;
gint i = 0;
if (back) {
vp.comps.active = g_list_last(vp.comps.completions);
- for (GList *l = vp.comps.active; l && i < max_items; l = l->prev, i++) {
+ for (GList *l = vp.comps.active; l && i < max; l = l->prev, i++) {
gtk_widget_show_all(((Completion*)l->data)->event);
}
} else {
vp.comps.active = g_list_first(vp.comps.completions);
- for (GList *l = vp.comps.active; l && i < max_items; l = l->next, i++) {
+ for (GList *l = vp.comps.active; l && i < max; l = l->next, i++) {
gtk_widget_show_all(((Completion*)l->data)->event);
}
}
static Completion* completion_get_new(const gchar* label, const gchar* prefix)
{
- /* TODO make this configurable */
const gint padding = 2;
Completion* c = g_new0(Completion, 1);
time_t cookie_timeout;
#endif
gint scrollstep;
+ guint max_completion_items;
} Config;
typedef struct {
VpColor input_fg[VP_MSG_LAST];
VpColor input_bg[VP_MSG_LAST];
PangoFontDescription* input_font[VP_MSG_LAST];
+ /* completion */
VpColor comp_fg[VP_COMP_LAST];
VpColor comp_bg[VP_COMP_LAST];
PangoFontDescription* comp_font[VP_COMP_LAST];
Style style;
GHashTable* settings;
Hints hints;
-#if 0
- Ssl ssl;
- Communication comm;
- Info info;
-#endif
} VpCore;
/* main object */
{NULL, "completion-fg-active", TYPE_CHAR, setting_completion_style, {.s = "#fff"}},
{NULL, "completion-bg-normal", TYPE_CHAR, setting_completion_style, {.s = "#656565"}},
{NULL, "completion-bg-active", TYPE_CHAR, setting_completion_style, {.s = "#777777"}},
+ {NULL, "max-completion-items", TYPE_INTEGER, setting_completion_style, {.i = 15}},
{NULL, "hint-bg", TYPE_CHAR, setting_hint_style, {.s = "#ff0"}},
{NULL, "hint-bg-focus", TYPE_CHAR, setting_hint_style, {.s = "#8f0"}},
{NULL, "hint-fg", TYPE_CHAR, setting_hint_style, {.s = "#000"}},
pango_font_description_free(style->comp_font[type]);
}
style->comp_font[type] = pango_font_description_from_string(s->arg.s);
+ } else if (!g_strcmp0(s->name, "max-completion-items")) {
+ vp.config.max_completion_items = s->arg.i;
}
return TRUE;