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:
authorCampbell Barton <ideasman42@gmail.com>2020-10-02 10:23:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-02 10:43:31 +0300
commit63f525bae3301c4d43bc62576772f42786173cd2 (patch)
tree06f63b6172ac57ef30fb272844b471fa9579104e /source/blender/editors/space_text
parent09082e15d00457bc22826c7d419a6dfb6c9905bd (diff)
Fix text editor auto-complete refinement feature
Left/right arrow keys can refine the completion, this wasn't redrawing and there was an off-by-one error checking the next character.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index e754c143718..7d53f2a66cd 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -328,6 +328,7 @@ static int doc_scroll = 0;
static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
+ /* NOTE(campbell): this code could be refactored or rewritten. */
SpaceText *st = CTX_wm_space_text(C);
ScrArea *area = CTX_wm_area(C);
ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
@@ -425,6 +426,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
if (event->ctrl) {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
else {
/* Work out which char we are about to delete/pass */
@@ -433,15 +435,19 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
if ((ch == '_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
get_suggest_prefix(st->text, -1);
text_pop_suggest_list();
+ txt_move_left(st->text, false);
+ draw = 1;
}
else {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
}
else {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
}
}
@@ -457,23 +463,28 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
if (event->ctrl) {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
else {
/* Work out which char we are about to pass */
if (st->text->curl && st->text->curc < st->text->curl->len) {
- char ch = st->text->curl->line[st->text->curc + 1];
+ char ch = st->text->curl->line[st->text->curc];
if ((ch == '_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
get_suggest_prefix(st->text, 1);
text_pop_suggest_list();
+ txt_move_right(st->text, false);
+ draw = 1;
}
else {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
}
else {
texttool_suggest_clear();
retval = OPERATOR_CANCELLED;
+ draw = 1;
}
}
}