66 Text *text = id_cast<Text *>(
id);
70 text->filepath =
nullptr;
77 text->lines.clear_no_delete();
91 text->curl = text->lines.first();
93 text->sell = text->lines.first();
108 std::optional<Library *> ,
113 Text *text_dst = id_cast<Text *>(id_dst);
114 const Text *text_src = id_cast<Text *>(
const_cast<ID *
>(id_src));
117 if (text_src->filepath) {
118 text_dst->filepath =
BLI_strdup(text_src->filepath);
123 text_dst->lines.clear_no_delete();
124 text_dst->curl = text_dst->sell =
nullptr;
125 text_dst->compiled =
nullptr;
128 for (
TextLine &line_src : text_src->lines) {
132 line_dst->
len = line_src.
len;
133 line_dst->
format =
nullptr;
138 text_dst->curl = text_dst->sell = text_dst->lines.first();
139 text_dst->curc = text_dst->selc = 0;
146 Text *text = id_cast<Text *>(
id);
150 MEM_SAFE_DELETE(text->filepath);
158 Text *text = id_cast<Text *>(
id);
160 if (text->filepath !=
nullptr && text->filepath[0] !=
'\0') {
167 Text *text = id_cast<Text *>(
id);
175 text->compiled =
nullptr;
181 if (text->filepath) {
199 Text *text = id_cast<Text *>(
id);
202 text->compiled =
nullptr;
220 const int actual_len = ln.
line ? int(strlen(ln.
line)) : 0;
221 if (ln.
len != actual_len) {
222 printf(
"Error loading text, line lengths differ\n");
227 text->flags = (text->flags) & ~
TXT_ISEXT;
231 .id_code = Text::id_type,
233 .dependencies_id_types = 0,
235 .struct_size =
sizeof(
Text),
237 .name_plural =
N_(
"texts"),
240 .asset_type_info =
nullptr,
245 .make_local =
nullptr,
246 .foreach_id =
nullptr,
247 .foreach_cache =
nullptr,
249 .foreach_working_space_color =
nullptr,
250 .foreach_asset_weak_reference =
nullptr,
251 .owner_pointer_get =
nullptr,
255 .blend_read_after_liblink =
nullptr,
257 .blend_read_undo_preserve =
nullptr,
259 .lib_override_apply_post =
nullptr,
270 for (
TextLine *tmp = text->lines.first(), *tmp_next; tmp; tmp = tmp_next) {
271 tmp_next = tmp->next;
272 MEM_delete(tmp->line);
274 MEM_delete(tmp->format);
279 text->lines.clear_no_delete();
281 text->curl = text->sell =
nullptr;
299 ptrdiff_t bad_char, i = 0;
300 const ptrdiff_t
length = ptrdiff_t(strlen(*
str));
320 memcpy(newstr + mi, (*
str) + i,
length - i + 1);
324 memcpy(newstr + mi, (*
str) + i, bad_char);
326 const int mofs = mi + bad_char;
331 newstr[
length + added] =
'\0';
346 for (i = 0; i < tl->
len; i++) {
347 if (tl->
line[i] <
' ' && tl->
line[i] !=
'\t') {
348 memmove(tl->
line + i, tl->
line + i + 1, tl->
len - i);
362 int i, llen, lines_count;
368 for (i = 0; i <
len; i++) {
369 if (buffer[i] ==
'\n') {
375 memcpy(tmp->
line, &buffer[i - llen], llen);
397 if (llen != 0 || lines_count == 0 || buffer[
len - 1] ==
'\n') {
403 memcpy(tmp->
line, &buffer[i - llen], llen);
415 text->curl = text->sell = text->lines.first();
416 text->curc = text->selc = 0;
426 if (!text->filepath) {
430 STRNCPY(filepath_abs, text->filepath);
434 if (buffer ==
nullptr) {
443 if (
BLI_stat(filepath_abs, &st) != -1) {
444 text->mtime = st.st_mtime;
457 const char *filepath,
459 const bool is_internal)
467 STRNCPY(filepath_abs, filepath);
471 if (buffer ==
nullptr) {
479 ta->lines.clear_no_delete();
480 ta->curl = ta->sell =
nullptr;
486 if (is_internal ==
false) {
487 const size_t filepath_len = strlen(filepath);
489 memcpy(ta->filepath, filepath, filepath_len + 1);
496 if (
BLI_stat(filepath_abs, &st) != -1) {
497 ta->mtime = st.st_mtime;
535 if (!text->filepath) {
539 STRNCPY(filepath, text->filepath);
552 if ((st.st_mode & S_IFMT) != S_IFREG) {
556 if (st.st_mtime > text->mtime) {
569 if (!text->filepath) {
573 STRNCPY(filepath, text->filepath);
582 if (
result == -1 || (st.st_mode & S_IFMT) != S_IFREG) {
586 text->mtime = st.st_mtime;
597 TextLine *
l = MEM_new<TextLine>(
"textline");
599 memset(
l->_pad0, 0,
sizeof(
l->_pad0));
606 MEM_delete(line->
line);
612 line->
line = newline;
613 line->
len = strlen(newline);
623 memcpy(tmp->
line,
str, str_len);
624 tmp->
line[str_len] =
'\0';
642 if (!text->lines.first()) {
643 if (text->lines.last()) {
644 text->lines.first_ = text->lines.last();
647 text->lines.first_ = text->lines.last_ =
txt_new_line(
"");
651 if (!text->lines.last()) {
652 text->lines.last_ = text->lines.first();
655 top =
reinterpret_cast<TextLine **
>(&text->lines.first_);
656 bot =
reinterpret_cast<TextLine **
>(&text->lines.last_);
658 while ((*top)->prev) {
661 while ((*bot)->next) {
667 text->curl = text->sell;
670 text->curl = text->lines.first();
676 text->sell = text->curl;
725 if (text->compiled) {
739 *linep = &text->curl;
740 *charp = &text->curc;
745 *linep = &text->sell;
746 *charp = &text->selc;
751 return (text->selc == 0);
756 return (text->selc == text->sell->len);
785 if ((*linep)->prev) {
787 (*linep)->line, (*linep)->len, *charp,
TXT_TABSIZE);
788 *linep = (*linep)->
prev;
790 (*linep)->line, (*linep)->len, column,
TXT_TABSIZE);
817 if ((*linep)->next) {
819 (*linep)->line, (*linep)->len, *charp,
TXT_TABSIZE);
820 *linep = (*linep)->
next;
822 (*linep)->line, (*linep)->len, column,
TXT_TABSIZE);
839 for (
int i = 0; i < ch; i++) {
840 if (tl->
line[i] !=
' ') {
855 if (tl->
line[ch] ==
' ') {
857 for (i = 0; i < ch; i++) {
858 if (tl->
line[i] !=
' ') {
892 if ((*linep)->prev) {
894 *charp = (*linep)->len;
933 if (*charp == (*linep)->len) {
934 if ((*linep)->next) {
1046 *charp = (*linep)->
len;
1068 *linep = text->lines.first();
1091 *linep = text->lines.last();
1092 *charp = (*linep)->len;
1120 *linep = text->lines.first();
1121 for (i = 0; i < line; i++) {
1122 if ((*linep)->next) {
1123 *linep = (*linep)->
next;
1129 if (ch >
uint((*linep)->len)) {
1130 ch =
uint((*linep)->len);
1151 text->curl = text->sell;
1155 text->curc = text->selc;
1162 (text->curl == text->sell && text->curc > text->selc))
1173 (text->curl == text->sell && text->curc < text->selc))
1183 text->sell = text->curl;
1184 text->selc = text->curc;
1197 if (reverse ==
false) {
1199 (text->curl == text->sell && text->curc > text->selc))
1206 (text->curl == text->sell && text->curc < text->selc))
1215 return ((text->curl != text->sell) || (text->curc != text->selc));
1237 size_t(text->curc) + (
size_t(text->sell->len) -
size_t(text->selc)) + 1,
"textline_string");
1239 memcpy(buf, text->curl->line, text->curc);
1240 memcpy(buf + text->curc, text->sell->line + text->selc, text->sell->len - text->selc);
1241 buf[text->curc + (text->sell->len - text->selc)] = 0;
1246 while (tmpl != text->curl) {
1255 text->sell = text->curl;
1256 text->selc = text->curc;
1261 text->curl = text->lines.first();
1264 text->sell = text->lines.last();
1265 text->selc = text->sell->len;
1271 text->curl = text->sell;
1272 text->curc = text->selc;
1283 text->sell = text->curl;
1284 text->selc = text->sell->len;
1292 if (startl < 0 || endl < 0) {
1293 int end = text->lines.count() - 1;
1295 startl = end + startl + 1;
1298 endl = end + endl + 1;
1305 if (froml ==
nullptr) {
1306 froml = text->lines.last();
1308 if (startl == endl) {
1313 if (tol ==
nullptr) {
1314 tol = text->lines.last();
1321 startc = std::max(0, fromllen + startc + 1);
1325 endc = std::max(0, tollen + endc + 1);
1353 buf_len +=
l.len + 1;
1356 char *buf_step = buf;
1358 memcpy(buf_step,
l.line,
l.len);
1362 *r_buf_len = buf_len;
1368 const char *buf_end = buf + buf_len;
1369 const char *buf_step = buf;
1374 TextLine *l_src = text->lines.first();
1375 text->lines.clear_no_delete();
1376 while (buf_step != buf_end && l_src) {
1378 const char *buf_step_next = strchr(buf_step,
'\n');
1379 const int len = buf_step_next - buf_step;
1382 l_src = l_src->
next;
1383 if (
l->len !=
len) {
1387 MEM_SAFE_DELETE(
l->format);
1389 memcpy(
l->line, buf_step,
len);
1390 l->line[
len] =
'\0';
1392 buf_step = buf_step_next + 1;
1396 while (l_src !=
nullptr) {
1398 MEM_delete(l_src->
line);
1400 MEM_delete(l_src->
format);
1406 while (buf_step != buf_end) {
1408 const char *buf_step_next = strchr(buf_step,
'\n');
1409 const int len = buf_step_next - buf_step;
1414 l->format =
nullptr;
1416 memcpy(
l->line, buf_step,
len);
1417 l->line[
len] =
'\0';
1419 buf_step = buf_step_next + 1;
1422 text->curl = text->sell = text->lines.first();
1423 text->curc = text->selc = 0;
1436 const bool has_data = !text->lines.is_empty();
1440 buf_len +=
l.len + 1;
1446 char *buf_step = buf;
1448 memcpy(buf_step,
l.line,
l.len);
1458 *r_buf_strlen = buf_len;
1480 if (text->curl == text->sell) {
1481 linef = linel = text->curl;
1483 if (text->curc < text->selc) {
1507 if (linef == linel) {
1515 length = (linef->
len - charf) + charl + 1;
1517 for (tmp = linef->
next; tmp && tmp != linel; tmp = tmp->
next) {
1523 memcpy(buf, linef->
line + charf, linef->
len - charf);
1527 for (tmp = linef->
next; tmp && tmp != linel; tmp = tmp->
next) {
1547 BLI_assert(in_buffer_len == strlen(in_buffer));
1560 while (buffer[i] && buffer[i] !=
'\n') {
1564 if (buffer[i] ==
'\n') {
1568 while (i < in_buffer_len) {
1571 while (buffer[i] && buffer[i] !=
'\n') {
1576 if (buffer[i] ==
'\n') {
1582 for (j = i -
l; j < i && j < in_buffer_len;) {
1602 const char *s =
nullptr;
1604 if (!text->curl || !text->sell) {
1610 tl = startl = text->sell;
1613 s = strstr(&tl->
line[text->selc], findstr);
1622 tl = text->lines.first();
1630 s = strstr(tl->
line, findstr);
1642 int newc = int(s - tl->
line);
1644 txt_move_to(text, newl, newc + strlen(findstr),
true);
1672 memcpy(left, text->curl->line, text->curc);
1674 left[text->curc] = 0;
1678 memcpy(right, text->curl->line + text->curc, text->curl->len - text->curc + 1);
1680 MEM_delete(text->curl->line);
1681 if (text->curl->format) {
1682 MEM_delete(text->curl->format);
1690 ins->
len = text->curc;
1692 text->curl->line = right;
1693 text->curl->format =
nullptr;
1694 text->curl->len = text->curl->len - text->curc;
1715 MEM_delete(line->
line);
1718 MEM_delete(line->
format);
1731 if (!linea || !lineb) {
1739 memcpy(s, linea->
line, linea->
len);
1741 memcpy(s, lineb->
line, lineb->
len);
1762 if (text->curl == text->sell) {
1782 if (text->curc == text->curl->len) {
1783 if (text->curl->next) {
1792 int pos = text->curc;
1794 size_t c_len = pos - text->curc;
1796 memmove(text->curl->line + text->curc,
1797 text->curl->line + text->curc + c_len,
1798 text->curl->len - text->curc - c_len + 1);
1800 text->curl->len -= c_len;
1827 if (text->curc == 0) {
1828 if (!text->curl->prev) {
1832 text->curl = text->curl->prev;
1833 text->curc = text->curl->len;
1839 int pos = text->curc;
1841 size_t c_len = text->curc - pos;
1844 memmove(text->curl->line + text->curc - c_len,
1845 text->curl->line + text->curc,
1846 text->curl->len - text->curc + 1);
1848 text->curl->len -= c_len;
1849 text->curc -= c_len;
1895 if (add ==
'\t' && replace_tabs) {
1907 memcpy(tmp, text->curl->line, text->curc);
1908 memcpy(tmp + text->curc, ch, add_len);
1910 tmp + text->curc + add_len, text->curl->line + text->curc, text->curl->len - text->curc + 1);
1914 text->curc += add_len;
1943 size_t del_size = 0, add_size;
1951 if (text->curc == text->curl->len ||
txt_has_sel(text) || add ==
'\n') {
1955 del_size = text->curc;
1957 del_size -= text->curc;
1961 if (add_size > del_size) {
1963 size_t(text->curl->len) + add_size - del_size + 1,
"textline_string");
1964 memcpy(tmp, text->curl->line, text->curc);
1965 memcpy(tmp + text->curc + add_size,
1966 text->curl->line + text->curc + del_size,
1967 text->curl->len - text->curc - del_size + 1);
1968 MEM_delete(text->curl->line);
1969 text->curl->line = tmp;
1971 else if (add_size < del_size) {
1972 char *tmp = text->curl->line;
1973 memmove(tmp + text->curc + add_size,
1974 tmp + text->curc + del_size,
1975 text->curl->len - text->curc - del_size + 1);
1978 memcpy(text->curl->line + text->curc, ch, add_size);
1979 text->curc += add_size;
1980 text->curl->len += add_size - del_size;
1995 int len,
num, curc_old, selc_old;
1998 const int indentlen = strlen(add);
2002 curc_old = text->curc;
2003 selc_old = text->selc;
2009 if ((text->curl->len != 0) || (skip_blank_lines == 0)) {
2015 memcpy(tmp, text->curl->line, text->curc);
2017 memcpy(tmp + text->curc, add, indentlen);
2019 len = text->curl->len - text->curc;
2021 memcpy(tmp + text->curc + indentlen, text->curl->line + text->curc,
len);
2023 tmp[text->curl->len + indentlen] = 0;
2027 text->curc += indentlen;
2033 if (text->curl == text->sell) {
2034 if (text->curl->len != 0) {
2035 text->selc += indentlen;
2040 text->curl = text->curl->next;
2045 text->curl = text->curl->prev;
2050 if (curc_old == 0 && !(text->curl == text->sell && curc_old == selc_old)) {
2051 if (text->curl == text->sell) {
2052 if (text->curc == text->selc) {
2059 if (text->curl->len != 0) {
2060 text->curc = curc_old + indentlen;
2076 const int indentlen = strlen(remove);
2077 bool unindented_first =
false;
2078 bool changed_any =
false;
2087 if (
STREQLEN(
l->line, remove, indentlen)) {
2092 for (
int i = 0; i <
l->len; i++) {
2093 if (!
ELEM(
l->line[i],
'\t',
' ')) {
2098 if (
l == text->sell) {
2106 bool changed =
false;
2107 if (
STREQLEN(text->curl->line, remove, indentlen)) {
2109 unindented_first =
true;
2111 text->curl->len -= indentlen;
2112 memmove(text->curl->line, text->curl->line + indentlen, text->curl->len + 1);
2120 if (text->curl == text->sell) {
2122 text->selc = std::max(text->selc - indentlen, 0);
2127 text->curl = text->curl->next;
2131 if (unindented_first) {
2132 text->curc = std::max(text->curc - indentlen, 0);
2136 text->curl = text->curl->prev;
2146 if (
ELEM(
nullptr, text->curl, text->sell)) {
2156 if (
ELEM(
nullptr, text->curl, text->sell)) {
2167 if (
ELEM(
nullptr, text->curl, text->sell)) {
2178 if (
ELEM(
nullptr, text->curl, text->sell)) {
2191 if (!text->curl || !text->sell) {
2197 line_other = (direction ==
TXT_MOVE_LINE_DOWN) ? text->sell->next : text->curl->prev;
2220 const char *word =
":";
2221 const char *comm =
"#";
2223 static const char *back_words[] = {
"return",
"break",
"continue",
"pass",
"yield",
nullptr};
2229 while (text->curl->line[i] == indent) {
2231 if (i == text->curc) {
2237 if (strstr(text->curl->line, word)) {
2244 bool is_indent =
false;
2245 for (a = 0; (a < text->curc) && (text->curl->line[a] !=
'\0'); a++) {
2246 char ch = text->curl->line[a];
2253 else if (!
ELEM(ch,
' ',
'\t')) {
2262 for (test = 0; back_words[test]; test++) {
2264 if (strstr(text->curl->line, back_words[test]) && i > 0) {
2265 if (strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm)) {
2282 const char opens[] =
"([{";
2283 const char close[] =
")]}";
2285 for (a = 0; a < (
sizeof(opens) - 1); a++) {
2286 if (ch == opens[a]) {
2289 if (ch == close[a]) {
2302 char delims[] =
"():\"\' ~!%^&*-+=[]{};/<>|.#\t,@";
2304 for (a = 0; a < (
sizeof(delims) - 1); a++) {
2305 if (ch == delims[a]) {
2334 if (ch <=
'Z' || ch ==
'_') {
2354 if (ch <=
'Z' || ch ==
'_') {
2380 if (
ELEM(ch,
' ',
'\t',
'\r',
'\n')) {
2388 if (i <= 0) [[unlikely]] {
File and directory operations.
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_TEXT
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
Read Blender memory allocation and freeing.
#define STREQLEN(a, b, n)
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#define MEM_realloc_uninitialized(vmemh, len)
float length(VecOp< float, D >) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
BLI_INLINE Texture * wrap(MTLTexture *texture)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
struct Text * BKE_text_add(struct Main *bmain, const char *name)
bool text_check_identifier(char ch)
bool text_check_digit(char ch)
int txt_get_span(const struct TextLine *from, const struct TextLine *to)
char * STRNCPY(char(&dst)[N], const char *src)
static TextLine * txt_new_line(const char *str)
int txt_calc_tab_left(const struct TextLine *tl, int ch)
size_t BLI_str_utf8_from_unicode(unsigned int c, char *dst, size_t dst_maxncpy) ATTR_NONNULL(2)
static void txt_select_prefix(Text *text, const char *add, bool skip_blank_lines)
void txt_jump_left(struct Text *text, bool sel, bool use_init_step)
ptrdiff_t BLI_str_utf8_invalid_byte(const char *str, size_t str_len) ATTR_NONNULL(1)
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len) ATTR_NONNULL(1
void txt_indent(struct Text *text)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
bool BKE_bpath_foreach_path_allocated_process(BPathForeachPathData *bpath_data, char **path)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static bool txt_add_char_intern(Text *text, uint add, bool replace_tabs)
bool BLI_str_cursor_step_next_utf8(const char *str, int str_maxlen, int *pos)
int txt_extended_ascii_as_utf8(char **str)
static void txt_make_dirty(Text *text)
void txt_move_eof(struct Text *text, bool sel)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static TextLine * txt_new_linen(const char *str, int str_len)
static void txt_convert_tab_to_spaces(Text *text)
bool BKE_text_reload(struct Text *text)
void txt_backspace_char(struct Text *text)
bool text_check_identifier_nodigit(char ch)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void txt_delete_line(Text *text, TextLine *line)
void txt_move_bof(struct Text *text, bool sel)
bool txt_has_sel(const struct Text *text)
void BPY_text_free_code(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
void id_fake_user_set(ID *id)
char * txt_to_buf_for_undo(struct Text *text, size_t *r_buf_len) ATTR_NONNULL(1
int text_find_identifier_start(const char *str, int i)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
int char * BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void txt_sel_set(struct Text *text, int startl, int startc, int endl, int endc)
static void txt_curs_cur(Text *text, TextLine ***linep, int **charp)
void txt_sel_clear(struct Text *text)
void txt_duplicate_line(struct Text *text)
bool txt_add_char(struct Text *text, unsigned int add)
void txt_comment(struct Text *text, const char *prefix)
void txt_move_toline(struct Text *text, unsigned int line, bool sel)
static TextLine * txt_line_malloc() ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
static void text_init_data(ID *id)
bool text_check_delim(char ch)
bool txt_cursor_is_line_start(const struct Text *text)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool txt_unindent(struct Text *text)
char * BLI_file_read_text_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
bool txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case)
static void txt_pop_first(Text *text)
int text_check_identifier_nodigit_unicode(unsigned int ch)
struct Text * BKE_text_load_ex(struct Main *bmain, const char *filepath, const char *relbase, bool is_internal) ATTR_NONNULL(1
void txt_delete_word(struct Text *text)
int txt_calc_tab_right(const struct TextLine *tl, int ch)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int txt_setcurr_tab_spaces(struct Text *text, int space)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
bool txt_cursor_is_line_end(const struct Text *text)
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void txt_pop_sel(struct Text *text)
void txt_sel_all(struct Text *text)
void txt_move_lines(struct Text *text, int direction)
void txt_clean_text(struct Text *text)
void void txt_split_curline(struct Text *text)
static void text_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void txt_from_buf_for_undo(struct Text *text, const char *buf, size_t buf_len) ATTR_NONNULL(1
void txt_delete_selected(struct Text *text)
bool BLI_str_cursor_step_prev_utf8(const char *str, int str_maxlen, int *pos)
int BLI_str_utf8_offset_to_column_with_tabs(const char *str, size_t str_len, int offset_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
ATTR_WARN_UNUSED_RESULT const size_t num
bool text_check_whitespace(char ch)
int text_check_identifier_unicode(unsigned int ch)
void txt_move_left(struct Text *text, bool sel)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void txt_move_down(struct Text *text, bool sel)
char * txt_sel_to_buf(const struct Text *text, size_t *r_buf_strlen)
bool txt_uncomment(struct Text *text, const char *prefix)
static void text_foreach_path(ID *id, BPathForeachPathData *bpath_data)
void int BKE_text_file_modified_check(const struct Text *text)
int BLI_str_utf8_offset_from_index(const char *str, size_t str_len, int index_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void txt_move_right(struct Text *text, bool sel)
int text_check_bracket(char ch)
static bool txt_select_unprefix(Text *text, const char *remove, const bool require_all)
void txt_sel_line(struct Text *text)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static void make_new_line(TextLine *line, char *newline)
void txt_move_bol(struct Text *text, bool sel)
void txt_move_up(struct Text *text, bool sel)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void BLI_str_cursor_step_utf8(const char *str, int str_maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step)
@ USER_TXT_TABSTOSPACES_DISABLE
static void text_blend_read_data(BlendDataReader *reader, ID *id)
static void cleanup_textline(TextLine *tl)
static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
char * txt_to_buf(struct Text *text, size_t *r_buf_strlen) ATTR_NONNULL(1
struct Text struct Text * BKE_text_load(struct Main *bmain, const char *filepath, const char *relbase) ATTR_NONNULL(1
void BKE_text_write(struct Text *text, const char *str, int str_len) ATTR_NONNULL(1
void txt_jump_right(struct Text *text, bool sel, bool use_init_step)
bool ATTR_WARN_UNUSED_RESULT
static void txt_curs_swap(Text *text)
static void txt_pop_last(Text *text)
void txt_delete_char(struct Text *text)
static void txt_curs_sel(Text *text, TextLine ***linep, int **charp)
void BKE_text_free_lines(struct Text *text)
static void text_from_buf(Text *text, const uchar *buffer, const int len)
void txt_move_eol(struct Text *text, bool sel)
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BKE_text_file_modified_ignore(struct Text *text)
void txt_order_cursors(struct Text *text, bool reverse)
static char tab_to_spaces[]
void txt_backspace_word(struct Text *text)
void * BKE_id_new(Main *bmain, short type, const char *name)
void txt_move_to(struct Text *text, unsigned int line, unsigned int ch, bool sel)
static void txt_delete_sel(Text *text)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
int BLI_str_utf8_offset_from_column_with_tabs(const char *str, size_t str_len, int column_target, int tab_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool txt_replace_char(struct Text *text, unsigned int add)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
static void text_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
static void text_free_data(ID *id)
struct Text struct Text void BKE_text_clear(struct Text *text) ATTR_NONNULL(1)
bool txt_add_raw_char(struct Text *text, unsigned int add)
@ IDTYPE_FLAGS_NO_ANIMDATA
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void write_string(const char *data)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)