58 if (!last || !first) {
73 y = region->winy - lheight *
l - 2;
78 if (mval[0] < x || x +
w < mval[0] || mval[1] < y - h || y < mval[1]) {
83 for (i = 0, item = first; i < *top && item->
next; i++, item = item->
next) {
88 tgti = (y - mval[1] - 4) / lheight;
93 for (i = tgti; i > 0 && item->
next; i--, item = item->
next) {
112 while (item && item != sel) {
144 seek_len = text->curc - i;
145 seek = text->curl->line + i;
159 while (i_start < linep->
len) {
162 while ((i_start < linep->
len) &&
168 i_pos = i_end = i_start;
169 while ((i_end < linep->
len) &&
176 if ((i_start != i_end) &&
182 char *str_sub = &linep->line[i_start];
183 const int choice_len = i_end - i_start;
185 if ((choice_len > seek_len) && (seek_len == 0 ||
STREQLEN(seek, str_sub, seek_len)) &&
189 char str_sub_last = str_sub[choice_len];
190 str_sub[choice_len] =
'\0';
196 str_sub[choice_len] = str_sub_last;
199 if (i_end != i_start) {
242 line = text->curl->line;
244 len = text->curc - i + offset;
266 line = text->curl->line;
268 over = text->curc - i;
273 const char *buf = sel->
name + over;
323 int draw = 0, tools = 0, swallow = 0, scroll = 1;
332 switch (event->
type) {
467 while (sel && scroll--) {
492 while (sel && scroll--) {
562 ot->
name =
"Text Auto Complete";
563 ot->
description =
"Show a list of used text in the open document";
564 ot->
idname =
"TEXT_OT_autocomplete";
SpaceText * CTX_wm_space_text(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Text * CTX_data_edit_text(const bContext *C)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
int text_check_identifier_unicode(unsigned int ch)
void txt_move_left(struct Text *text, bool sel)
void txt_move_right(struct Text *text, bool sel)
int text_check_identifier_nodigit_unicode(unsigned int ch)
bool text_check_whitespace(char ch)
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len) ATTR_NONNULL(1
int text_find_identifier_start(const char *str, int i)
short texttool_text_is_active(struct Text *text)
void texttool_text_clear(void)
void texttool_suggest_prefix(const char *prefix, int prefix_len)
int * texttool_suggest_top(void)
SuggItem * texttool_suggest_first(void)
void texttool_suggest_select(SuggItem *sel)
void texttool_suggest_add(const char *name, char type)
SuggItem * texttool_suggest_last(void)
void texttool_text_set_active(struct Text *text)
SuggItem * texttool_suggest_selected(void)
void texttool_suggest_clear(void)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define LISTBASE_FOREACH(type, var, list)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int BLI_str_utf8_as_unicode_step_safe(const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
unsigned int BLI_str_utf8_as_unicode_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STREQLEN(a, b, n)
void ED_area_tag_redraw(ScrArea *area)
UndoStep * ED_text_undo_push_init(bContext *C)
void ED_undo_push(bContext *C, const char *str)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMLoop * l
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void MEM_freeN(void *vmemh)
SpaceText_Runtime * runtime
char(* format_identifier)(const char *string)
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
struct wmOperatorType * type
void TEXT_OT_autocomplete(wmOperatorType *ot)
static int text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *)
static GHash * text_autocomplete_build(Text *text)
static void text_autocomplete_free(bContext *C, wmOperator *op)
static void confirm_suggestion(Text *text)
static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *event)
void text_pop_suggest_list()
bool space_text_do_suggest_select(SpaceText *st, const ARegion *region, const int mval[2])
static void get_suggest_prefix(Text *text, int offset)
static void text_autocomplete_cancel(bContext *C, wmOperator *op)
TextFormatType * ED_text_format_get(Text *text)
#define TXT_LINE_HEIGHT(st)
bool text_space_edit_poll(bContext *C)
void space_text_update_character_width(SpaceText *st)
#define TXT_BODY_LEFT(st)
void text_update_line_edited(TextLine *line)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)