62 if (!last || !first) {
67 for (tmp = st->
text->curl,
l = -st->
top; tmp; tmp = tmp->
prev,
l++) {
77 y = region->
winy - line_height *
l - 2;
82 if (mval[0] <
x ||
x +
w < mval[0] || mval[1] <
y - h ||
y < mval[1]) {
87 for (i = 0, item = first; i < *top && item->
next; i++, item = item->
next) {
92 tgti = (
y - mval[1] - 4) / line_height;
97 for (i = tgti; i > 0 && item->
next; i--, item = item->
next) {
116 while (item && item != sel) {
148 seek_len = text->curc - i;
149 seek = text->curl->line + i;
158 for (
TextLine &linep : text->lines) {
163 while (i_start < linep.
len) {
166 while ((i_start < linep.
len) &&
172 i_pos = i_end = i_start;
173 while ((i_end < linep.
len) &&
180 if ((i_start != i_end) &&
186 char *str_sub = &linep.
line[i_start];
187 const int choice_len = i_end - i_start;
189 if ((choice_len > seek_len) && (seek_len == 0 ||
STREQLEN(seek, str_sub, seek_len)) &&
193 char str_sub_last = str_sub[choice_len];
194 str_sub[choice_len] =
'\0';
200 str_sub[choice_len] = str_sub_last;
203 if (i_end != i_start) {
246 line = text->curl->line;
248 len = text->curc - i + offset;
270 line = text->curl->line;
272 over = text->curc - i;
277 const char *buf = sel->
name + over;
329 int draw = 0, tools = 0, swallow = 0, scroll = 1;
338 switch (event->
type) {
405 if (st->
text->curl && st->
text->curc > 0) {
406 char ch = st->
text->curl->line[st->
text->curc - 1];
438 if (st->
text->curl && st->
text->curc < st->
text->curl->len) {
439 char ch = st->
text->curl->line[st->
text->curc];
473 while (sel && scroll--) {
498 while (sel && scroll--) {
570 ot->
name =
"Text Auto Complete";
571 ot->
description =
"Show a list of used text in the open document";
572 ot->
idname =
"TEXT_OT_autocomplete";
#define GHASH_ITER(gh_iter_, ghash_)
Read Blender memory allocation and freeing.
#define STREQLEN(a, b, n)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool text_space_edit_poll(bContext *C)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
ScrArea * CTX_wm_area(const bContext *C)
static wmOperatorStatus text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *)
void texttool_suggest_prefix(const char *prefix, int prefix_len)
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len) ATTR_NONNULL(1
GHash * BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void text_update_line_edited(TextLine *line)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void TEXT_OT_autocomplete(wmOperatorType *ot)
SuggItem * texttool_suggest_first()
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void texttool_suggest_clear()
SuggItem * texttool_suggest_last()
static void text_autocomplete_cancel(bContext *C, wmOperator *op)
TextFormatType * ED_text_format_get(Text *text)
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
static GHash * text_autocomplete_build(Text *text)
Text * CTX_data_edit_text(const bContext *C)
int text_find_identifier_start(const char *str, int i)
void MEM_delete_void(void *vmemh)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
SpaceText * CTX_wm_space_text(const bContext *C)
int text_check_identifier_nodigit_unicode(unsigned int ch)
bool space_text_do_suggest_select(SpaceText *st, const ARegion *region, const int mval[2])
static void confirm_suggestion(Text *text)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
short texttool_text_is_active(struct Text *text)
void texttool_suggest_add(const char *name, char type)
static void text_autocomplete_free(bContext *C, wmOperator *op)
bool text_check_whitespace(char ch)
int text_check_identifier_unicode(unsigned int ch)
void txt_move_left(struct Text *text, bool sel)
static wmOperatorStatus text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *event)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
int * texttool_suggest_top()
void txt_move_right(struct Text *text, bool sel)
SuggItem * texttool_suggest_selected()
UndoStep * ED_text_undo_push_init(bContext *C)
unsigned int BLI_str_utf8_as_unicode_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void get_suggest_prefix(Text *text, int offset)
void text_pop_suggest_list()
void space_text_update_character_width(SpaceText *st)
void texttool_suggest_select(SuggItem *sel)
void texttool_text_set_active(struct Text *text)
void texttool_text_clear()
void ED_area_tag_redraw(ScrArea *area)
ed::text::SpaceText_Runtime * runtime
char(*) format_identifier(const char *string)
wmEventModifierFlag modifier
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type
#define TXT_LINE_HEIGHT(st)
#define TXT_BODY_LEFT(st)