From d90d413421a39e6c5b96fbe483090a13bc9a4569 Mon Sep 17 00:00:00 2001 From: Ian Thompson Date: Mon, 11 Aug 2008 11:10:16 +0000 Subject: Suggestion list scrolling and selection made independent for easier use. Selections no longer move away from the cursor. --- source/blender/blenkernel/intern/suggestions.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/suggestions.c') diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index edccc0886f6..54ce425a04a 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -65,6 +65,7 @@ static void txttl_free_suggest() { suggestions.first = suggestions.last = NULL; suggestions.firstmatch = suggestions.lastmatch = NULL; suggestions.selected = NULL; + suggestions.top = 0; } static void txttl_free_docs() { @@ -149,11 +150,12 @@ void texttool_suggest_add(const char *name, char type) { } } suggestions.firstmatch = suggestions.lastmatch = suggestions.selected = NULL; + suggestions.top= 0; } void texttool_suggest_prefix(const char *prefix) { SuggItem *match, *first, *last; - int cmp, len = strlen(prefix); + int cmp, len = strlen(prefix), top = 0; if (!suggestions.first) return; if (len==0) { @@ -166,14 +168,17 @@ void texttool_suggest_prefix(const char *prefix) { for (match=suggestions.first; match; match=match->next) { cmp = txttl_cmp(prefix, match->name, len); if (cmp==0) { - if (!first) + if (!first) { first = match; + suggestions.top = top; + } } else if (cmp<0) { if (!last) { last = match->prev; break; } } + top++; } if (first) { if (!last) last = suggestions.last; @@ -184,6 +189,7 @@ void texttool_suggest_prefix(const char *prefix) { suggestions.firstmatch = NULL; suggestions.lastmatch = NULL; suggestions.selected = NULL; + suggestions.top = 0; } } @@ -207,6 +213,10 @@ SuggItem *texttool_suggest_selected() { return suggestions.selected; } +int *texttool_suggest_top() { + return &suggestions.top; +} + /*************************/ /* Documentation methods */ /*************************/ -- cgit v1.2.3