diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_suggestions.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/suggestions.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_text/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_autocomplete.c (renamed from source/blender/editors/space_text/text_python.c) | 10 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 4 |
5 files changed, 10 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h index 9b61d9141fb..c36a2d61968 100644 --- a/source/blender/blenkernel/BKE_suggestions.h +++ b/source/blender/blenkernel/BKE_suggestions.h @@ -75,7 +75,7 @@ short texttool_text_is_active(Text *text); /* Suggestions */ void texttool_suggest_add(const char *name, char type); -void texttool_suggest_prefix(const char *prefix); +void texttool_suggest_prefix(const char *prefix, const int prefix_len); void texttool_suggest_clear(void); SuggItem *texttool_suggest_first(void); SuggItem *texttool_suggest_last(void); diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index ff9774f85af..6f9736df683 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -163,13 +163,13 @@ void texttool_suggest_add(const char *name, char type) suggestions.top = 0; } -void texttool_suggest_prefix(const char *prefix) +void texttool_suggest_prefix(const char *prefix, const int prefix_len) { SuggItem *match, *first, *last; - int cmp, len = strlen(prefix), top = 0; + int cmp, top = 0; if (!suggestions.first) return; - if (len == 0) { + if (prefix_len == 0) { suggestions.selected = suggestions.firstmatch = suggestions.first; suggestions.lastmatch = suggestions.last; return; @@ -177,7 +177,7 @@ void texttool_suggest_prefix(const char *prefix) first = last = NULL; for (match = suggestions.first; match; match = match->next) { - cmp = txttl_cmp(prefix, match->name, len); + cmp = txttl_cmp(prefix, match->name, prefix_len); if (cmp == 0) { if (!first) { first = match; diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index b9e4e2f0afa..a33a9abada1 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -36,13 +36,13 @@ set(INC_SYS set(SRC space_text.c + text_autocomplete.c text_draw.c text_format.c text_format_osl.c text_format_py.c text_header.c text_ops.c - text_python.c text_format.h text_intern.h diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_autocomplete.c index 1201302dad0..044c5322f23 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -122,7 +122,7 @@ void text_pop_suggest_list(void) static void get_suggest_prefix(Text *text, int offset) { int i, len; - char *line, tmp[256]; + char *line; if (!text) return; if (!texttool_text_is_active(text)) return; @@ -133,13 +133,7 @@ static void get_suggest_prefix(Text *text, int offset) break; i++; len = text->curc - i + offset; - if (len > 255) { - printf("Suggestion prefix too long\n"); - len = 255; - } - BLI_strncpy(tmp, line + i, len); - tmp[len] = '\0'; - texttool_suggest_prefix(tmp); + texttool_suggest_prefix(line + i, len); } static void confirm_suggestion(Text *text, int skipleft) diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 11a5687915b..6e33fc122b5 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -894,7 +894,7 @@ static void draw_documentation(SpaceText *st, ARegion *ar) /* top = */ /* UNUSED */ y = ar->winy - st->lheight_dpi * l - 2; boxw = DOC_WIDTH * st->cwidth + 20; - boxh = (DOC_HEIGHT + 1) * st->lheight_dpi; + boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING); /* Draw panel */ UI_ThemeColor(TH_BACK); @@ -981,7 +981,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) else { x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET - 4; } - y = ar->winy - st->lheight_dpi * l - 2; + y = ar->winy - (st->lheight_dpi + TXT_LINE_SPACING) * l - 2; boxw = SUGG_LIST_WIDTH * st->cwidth + 20; boxh = SUGG_LIST_SIZE * st->lheight_dpi + 8; |