Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_text/text_autocomplete.c')
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c78
1 files changed, 61 insertions, 17 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 1637ae14892..04cff288b03 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -327,8 +327,13 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
if (text_do_suggest_select(st, ar))
swallow = 1;
else {
- if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+ if (tools & TOOL_SUGG_LIST) {
+ texttool_suggest_clear();
+ }
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ }
retval = OPERATOR_FINISHED;
}
draw = 1;
@@ -342,8 +347,13 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
swallow = 1;
}
else {
- if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+ if (tools & TOOL_SUGG_LIST) {
+ texttool_suggest_clear();
+ }
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ }
retval = OPERATOR_FINISHED;
}
draw = 1;
@@ -352,8 +362,13 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case ESCKEY:
if (event->val == KM_PRESS) {
draw = swallow = 1;
- if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
- else if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+ if (tools & TOOL_SUGG_LIST) {
+ texttool_suggest_clear();
+ }
+ else if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ }
else draw = swallow = 0;
retval = OPERATOR_CANCELLED;
}
@@ -367,7 +382,11 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
swallow = 1;
draw = 1;
}
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0, draw = 1;
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ draw = 1;
+ }
retval = OPERATOR_FINISHED;
}
break;
@@ -398,7 +417,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
}
}
}
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ }
}
break;
case RIGHTARROWKEY:
@@ -427,7 +449,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
}
}
}
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ }
}
break;
case PAGEDOWNKEY:
@@ -447,9 +472,15 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
texttool_suggest_select(texttool_suggest_first());
}
else {
- while (sel && sel != texttool_suggest_last() && sel->next && scroll--) {
- texttool_suggest_select(sel->next);
- sel = sel->next;
+ while (sel && scroll--) {
+ if (sel != texttool_suggest_last() && sel->next) {
+ texttool_suggest_select(sel->next);
+ sel = sel->next;
+ }
+ else {
+ texttool_suggest_select(texttool_suggest_first());
+ sel = texttool_suggest_first();
+ }
}
}
text_pop_suggest_list();
@@ -471,9 +502,15 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
}
else if (tools & TOOL_SUGG_LIST) {
SuggItem *sel = texttool_suggest_selected();
- while (sel && sel != texttool_suggest_first() && sel->prev && scroll--) {
- texttool_suggest_select(sel->prev);
- sel = sel->prev;
+ while (sel && scroll--) {
+ if (sel != texttool_suggest_first() && sel->prev) {
+ texttool_suggest_select(sel->prev);
+ sel = sel->prev;
+ }
+ else {
+ texttool_suggest_select(texttool_suggest_last());
+ sel = texttool_suggest_last();
+ }
}
text_pop_suggest_list();
swallow = 1;
@@ -486,8 +523,15 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
break;
#if 0
default:
- if (tools & TOOL_SUGG_LIST) texttool_suggest_clear(), draw = 1;
- if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0, draw = 1;
+ if (tools & TOOL_SUGG_LIST) {
+ texttool_suggest_clear();
+ draw = 1;
+ }
+ if (tools & TOOL_DOCUMENT) {
+ texttool_docs_clear();
+ doc_scroll = 0;
+ draw = 1;
+ }
#endif
}