diff options
author | Ian Thompson <quornian@googlemail.com> | 2008-08-11 15:10:16 +0400 |
---|---|---|
committer | Ian Thompson <quornian@googlemail.com> | 2008-08-11 15:10:16 +0400 |
commit | d90d413421a39e6c5b96fbe483090a13bc9a4569 (patch) | |
tree | 308abe4066ec06da5f9e53845cffd248cddbbdf3 /source/blender/blenkernel/intern/suggestions.c | |
parent | a5d955632f40f4a1abee4928c5068968b35a757e (diff) |
Suggestion list scrolling and selection made independent for easier use. Selections no longer move away from the cursor.
Diffstat (limited to 'source/blender/blenkernel/intern/suggestions.c')
-rw-r--r-- | source/blender/blenkernel/intern/suggestions.c | 14 |
1 files changed, 12 insertions, 2 deletions
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 */ /*************************/ |