87 else if (!
ELEM(c,
'\t',
' ')) {
88 *r_last_state =
false;
125 const int line1_char,
127 const int line2_char)
135 if (
txt_get_span(line1, line2) > 0 || (line1 == line2 && line1_char <= line2_char)) {
138 start_char = line1_char;
139 end_char = line2_char;
144 start_char = line2_char;
145 end_char = line1_char;
148 for (
const TextLine *line = start_line; line != end_line->
next; line = line->
next) {
149 const int start = (line == start_line) ? start_char : 0;
150 const int end = (line == end_line) ? end_char : line->len;
152 for (
int i = start; i < end; i++) {
153 if (!
ELEM(line->line[i],
' ',
'\t',
'\n')) {
171 bool line_start =
true;
174 for (
int in_offset = 0; in_buf[in_offset]; in_offset++) {
178 if (in_buf[in_offset] ==
'\t' && line_start) {
184 const int out_size = strlen(in_buf) + num_tabs * (tab_size - 1) + 1;
188 int spaces_until_tab = 0;
192 for (
int in_offset = 0; in_buf[in_offset]; in_offset++) {
196 if (in_buf[in_offset] ==
'\t' && line_start) {
198 int num_spaces = tab_size - (spaces_until_tab % tab_size);
199 spaces_until_tab = 0;
202 memset(&out_buf[out_offset],
' ', num_spaces);
203 out_offset += num_spaces;
206 if (in_buf[in_offset] ==
' ') {
209 else if (in_buf[in_offset] ==
'\n') {
210 spaces_until_tab = 0;
213 out_buf[out_offset++] = in_buf[in_offset];
217 out_buf[out_offset] =
'\0';
218 *r_out_buf_len = out_offset;
240 if (buf ==
nullptr) {
335 MEM_SAFE_DELETE(line->
format);
340 for (
TextLine &line : text->lines) {
386 ot->
name =
"New Text";
387 ot->
idname =
"TEXT_OT_new";
471 const char *filepath =
nullptr;
473 if (text && text->filepath) {
475 STRNCPY(filepath_buf, text->filepath);
477 filepath = filepath_buf;
480 filepath = text->filepath;
498 ot->
name =
"Open Text";
499 ot->
idname =
"TEXT_OT_open";
520 ot->
srna,
"internal",
false,
"Make Internal",
"Make text file internal after loading");
536 const int orig_top = st->
top;
537 const int orig_curl =
BLI_findindex(&text->lines, text->curl);
538 const int orig_curc = text->curc;
542 if (text->filepath ==
nullptr) {
553 if (text->compiled) {
578 IFACE_(
"Reload active text file?"),
589 ot->
idname =
"TEXT_OT_reload";
590 ot->
description =
"Reload active text data-block from its file";
619 st->
text =
static_cast<Text *
>(text->id.prev);
622 else if (text->id.next) {
623 st->
text =
static_cast<Text *
>(text->id.next);
640 IFACE_(
"Delete active text file?"),
651 ot->
idname =
"TEXT_OT_unlink";
675 MEM_SAFE_DELETE(text->filepath);
686 ot->
name =
"Make Internal";
687 ot->
idname =
"TEXT_OT_make_internal";
688 ot->
description =
"Make active text file internal";
710 if (text->filepath ==
nullptr) {
715 STRNCPY(filepath, text->filepath);
721 reports,
RPT_ERROR,
"Cannot save text file, path \"%s\" is not writable", filepath);
729 "Unable to save '%s': %s",
731 errno ? strerror(errno) :
RPT_(
"unknown error writing file"));
745 text->mtime = st.st_mtime;
754 "Unable to stat '%s': %s",
756 errno ? strerror(errno) :
RPT_(
"unknown error statting file"));
780 if (text->filepath ==
nullptr || (text->flags &
TXT_ISMEM)) {
791 ot->
idname =
"TEXT_OT_save";
818 if (text->filepath) {
819 MEM_delete(text->filepath);
841 const char *filepath =
nullptr;
843 if (text->filepath) {
845 STRNCPY(filepath_buf, text->filepath);
847 filepath = filepath_buf;
850 filepath = text->filepath;
854 filepath = text->id.name + 2;
870 ot->
name =
"Save As";
871 ot->
idname =
"TEXT_OT_save_as";
872 ot->
description =
"Save active text file with options";
899 const bool is_live = (reports ==
nullptr);
902 void *curl_prev = text->curl;
903 int curc_prev = text->curc;
904 int selc_prev = text->selc;
918 if (text->curl != curl_prev || curc_prev != text->curc || selc_prev != text->selc) {
950 ot->
name =
"Run Script";
951 ot->
idname =
"TEXT_OT_run_script";
1016 ot->
idname =
"TEXT_OT_paste";
1032 "Paste text selected elsewhere rather than copied (X11/Wayland only)");
1063 ot->
name =
"Duplicate Line";
1064 ot->
idname =
"TEXT_OT_duplicate_line";
1110 ot->
idname =
"TEXT_OT_copy";
1111 ot->
description =
"Copy selected text to clipboard";
1151 ot->
idname =
"TEXT_OT_cut";
1152 ot->
description =
"Cut selected text to clipboard";
1172 bool text_before_cursor = text->curc != 0 && !
ELEM(line->
line[text->curc - 1],
' ',
'\t');
1173 if (text_before_cursor && (
txt_has_sel(text) ==
false)) {
1186 ot->
name =
"Indent or Autocomplete";
1187 ot->
idname =
"TEXT_OT_indent_or_autocomplete";
1188 ot->
description =
"Indent selected text or autocomplete";
1232 ot->
name =
"Indent";
1233 ot->
idname =
"TEXT_OT_indent";
1273 ot->
name =
"Unindent";
1274 ot->
idname =
"TEXT_OT_unindent";
1305 for (a = 0; a < curts; a++) {
1315 if (text->curl->prev) {
1330 ot->
name =
"Line Break";
1331 ot->
idname =
"TEXT_OT_line_break";
1332 ot->
description =
"Insert line break at cursor position";
1388 {0,
"TOGGLE", 0,
"Toggle Comments",
nullptr},
1389 {1,
"COMMENT", 0,
"Comment",
nullptr},
1390 {-1,
"UNCOMMENT", 0,
"Un-Comment",
nullptr},
1391 {0,
nullptr, 0,
nullptr,
nullptr},
1395 ot->
name =
"Toggle Comments";
1396 ot->
idname =
"TEXT_OT_comment_toggle";
1407 prop =
RNA_def_enum(ot->
srna,
"type", comment_items, 0,
"Type",
"Add or remove comments");
1419 {
TO_SPACES,
"SPACES", 0,
"To Spaces",
nullptr},
1420 {
TO_TABS,
"TABS", 0,
"To Tabs",
nullptr},
1421 {0,
nullptr, 0,
nullptr,
nullptr},
1429 size_t a, j, max_len = 0;
1432 const int curc_column = text->curl ?
1434 text->curl->line, text->curl->len, text->curc,
TXT_TABSIZE) :
1436 const int selc_column = text->sell ?
1438 text->sell->line, text->sell->len, text->selc,
TXT_TABSIZE) :
1443 for (
TextLine &tmp : text->lines) {
1452 MEM_delete(tmp.
line);
1458 tmp.
line = new_line;
1459 tmp.
len = strlen(new_line);
1461 max_len = std::max<size_t>(tmp.
len, max_len);
1467 for (
TextLine &tmp : text->lines) {
1468 const char *text_check_line = tmp.
line;
1469 const int text_check_line_len = tmp.
len;
1470 char *tmp_line_cur = tmp_line;
1475 for (a = 0; a < text_check_line_len;) {
1477 if (!(a % tab_len) && (text_check_line[a] ==
' ')) {
1480 (j < tab_len) && (a + j < text_check_line_len) && (text_check_line[a + j] ==
' ');
1488 if ((tmp_line_cur == tmp_line) && a != 0) {
1490 memcpy(tmp_line_cur, text_check_line, a);
1493 *tmp_line_cur =
'\t';
1498 if (tmp_line_cur != tmp_line) {
1499 memcpy(tmp_line_cur, &text_check_line[a], j);
1507 if (tmp_line_cur != tmp_line) {
1508 memcpy(tmp_line_cur, &text_check_line[a],
len);
1509 tmp_line_cur +=
len;
1515 if (tmp_line_cur != tmp_line) {
1516 *tmp_line_cur =
'\0';
1519 BLI_assert(tmp_line_cur - tmp_line <= max_len);
1526 MEM_delete(tmp.
line);
1532 tmp.
len = strlen(tmp_line);
1538 MEM_delete(tmp_line);
1541 if (curc_column != -1) {
1543 text->curl->line, text->curl->len, curc_column,
TXT_TABSIZE);
1545 if (selc_column != -1) {
1547 text->sell->line, text->sell->len, selc_column,
TXT_TABSIZE);
1561 ot->
name =
"Convert Whitespace";
1562 ot->
idname =
"TEXT_OT_convert_whitespace";
1578 "Type of whitespace to convert to");
1604 ot->
name =
"Select All";
1605 ot->
idname =
"TEXT_OT_select_all";
1636 ot->
name =
"Select Line";
1637 ot->
idname =
"TEXT_OT_select_line";
1656 text->curl->line, text->curl->len, text->selc, &text->curc, &text->selc);
1669 ot->
name =
"Select Word";
1670 ot->
idname =
"TEXT_OT_select_word";
1709 {0,
nullptr, 0,
nullptr,
nullptr},
1713 ot->
name =
"Move Lines";
1714 ot->
idname =
"TEXT_OT_move_lines";
1715 ot->
description =
"Move the currently selected line(s) up/down";
1735 {
LINE_BEGIN,
"LINE_BEGIN", 0,
"Line Begin",
""},
1736 {
LINE_END,
"LINE_END", 0,
"Line End",
""},
1737 {
FILE_TOP,
"FILE_TOP", 0,
"File Top",
""},
1738 {
FILE_BOTTOM,
"FILE_BOTTOM", 0,
"File Bottom",
""},
1739 {
PREV_CHAR,
"PREVIOUS_CHARACTER", 0,
"Previous Character",
""},
1740 {
NEXT_CHAR,
"NEXT_CHARACTER", 0,
"Next Character",
""},
1741 {
PREV_WORD,
"PREVIOUS_WORD", 0,
"Previous Word",
""},
1742 {
NEXT_WORD,
"NEXT_WORD", 0,
"Next Word",
""},
1743 {
PREV_LINE,
"PREVIOUS_LINE", 0,
"Previous Line",
""},
1744 {
NEXT_LINE,
"NEXT_LINE", 0,
"Next Line",
""},
1745 {
PREV_PAGE,
"PREVIOUS_PAGE", 0,
"Previous Page",
""},
1746 {
NEXT_PAGE,
"NEXT_PAGE", 0,
"Next Page",
""},
1747 {0,
nullptr, 0,
nullptr,
nullptr},
1756 int i, j, start, end,
max, curs, endj, selc;
1757 bool chop, loop, found;
1762 selc = start = endj = curs = found =
false;
1771 ch = linein->
line[j];
1781 if (rell == 0 && i - start <= relc && i + columns - start > relc) {
1787 else if (i - end <= relc && i + columns - end > relc) {
1790 if (i + columns - start >
max) {
1791 end = std::min(end, i);
1796 if (selc > endj && !chop) {
1812 if (rell == 0 && i + columns - start > relc) {
1818 else if (ch ==
'\0') {
1825 else if (
ELEM(ch,
' ',
'-')) {
1831 if (rell == 0 && i + columns - start > relc) {
1855 int offl, offc, visible_lines;
1865 if (*rell - visible_lines + offl >= 0) {
1866 if (!(*linep)->next) {
1867 if (offl < visible_lines - 1) {
1868 *rell = visible_lines - 1;
1872 *charp = (*linep)->len;
1876 *rell -= visible_lines - offl;
1877 *linep = (*linep)->
next;
1885 if (*rell + offl <= 0) {
1886 if (!(*linep)->prev) {
1897 *linep = (*linep)->
prev;
1910 if (*rell + visible_lines >= 0) {
1911 *rell += visible_lines;
1915 if (!(*linep)->prev) {
1920 *rell += visible_lines;
1921 *linep = (*linep)->
prev;
1924 if (*rell - visible_lines < 0) {
1928 if (!(*linep)->next) {
1929 *rell = visible_lines - 1;
1933 *rell -= visible_lines;
1934 *linep = (*linep)->
next;
1946 int oldc, i, j,
max, start, end, endj;
1953 linep = &text->sell;
1954 charp = &text->selc;
1957 linep = &text->curl;
1958 charp = &text->curc;
1975 ch = (*linep)->line[j];
1985 if (i + columns - start >
max) {
1986 end = std::min(end, i);
1993 (*linep)->line, (*linep)->len, start,
TXT_TABSIZE);
2007 else if (
ELEM(ch,
' ',
'-',
'\0')) {
2010 (*linep)->line, (*linep)->len, start,
TXT_TABSIZE);
2033 int oldc, i, j,
max, start, end, endj;
2040 linep = &text->sell;
2041 charp = &text->selc;
2044 linep = &text->curl;
2045 charp = &text->curc;
2062 ch = (*linep)->line[j];
2072 if (i + columns - start >
max) {
2073 end = std::min(end, i);
2081 *charp = (*linep)->len;
2094 else if (ch ==
'\0') {
2095 *charp = (*linep)->len;
2099 else if (
ELEM(ch,
' ',
'-')) {
2118 int offl, offc, col;
2123 linep = &text->sell;
2124 charp = &text->selc;
2127 linep = &text->curl;
2128 charp = &text->curc;
2137 if ((*linep)->prev) {
2140 *linep = (*linep)->
prev;
2159 int offl, offc, col, visible_lines;
2164 linep = &text->sell;
2165 charp = &text->selc;
2168 linep = &text->curl;
2169 charp = &text->curc;
2175 if (offl < visible_lines - 1) {
2179 if ((*linep)->next) {
2180 *linep = (*linep)->
next;
2184 *charp = (*linep)->len;
2207 linep = &text->sell;
2208 charp = &text->selc;
2211 linep = &text->curl;
2212 charp = &text->curc;
2215 if (st && region && st->
wordwrap) {
2224 while (lines > 0 && (*linep)->next) {
2225 *linep = (*linep)->
next;
2228 while (lines < 0 && (*linep)->prev) {
2229 *linep = (*linep)->
prev;
2234 *charp = std::min(*charp, (*linep)->len);
2257 if (st && st->
wordwrap && region) {
2269 if (st && st->
wordwrap && region) {
2320 if (st && st->
wordwrap && region) {
2329 if (st && st->
wordwrap && region) {
2376 ot->
name =
"Move Cursor";
2377 ot->
idname =
"TEXT_OT_move";
2404 ot->
name =
"Move Select";
2405 ot->
idname =
"TEXT_OT_move_select";
2406 ot->
description =
"Move the cursor while selecting";
2418 "Where to move cursor to, to make a selection");
2431 short nlines =
txt_get_span(text->lines.first(), text->lines.last()) + 1;
2436 else if (line > nlines) {
2458 ot->
idname =
"TEXT_OT_jump";
2468 ot->
srna,
"line", 1, 1,
INT_MAX,
"Line",
"Line number to jump to", 1, 10000);
2480 {
DEL_PREV_CHAR,
"PREVIOUS_CHARACTER", 0,
"Previous Character",
""},
2483 {0,
nullptr, 0,
nullptr,
nullptr},
2488#ifdef WITH_INPUT_IME
2489 if (
const std::optional<wmOperatorStatus> status = WM_operator_IME_edit_maybe(
C)) {
2526 text->sell = text->curl;
2527 text->selc = text->curc - tabsize;
2533 const char *curr = text->curl->line + text->curc;
2534 if (*curr !=
'\0') {
2536 if ((curr != prev) &&
2559 text->sell = text->curl;
2560 text->selc = text->curc + tabsize;
2585 ot->
name =
"Delete";
2586 ot->
idname =
"TEXT_OT_delete";
2587 ot->
description =
"Delete text by cursor position";
2603 "Which part of the text to delete");
2627 ot->
name =
"Toggle Overwrite";
2628 ot->
idname =
"TEXT_OT_overwrite_toggle";
2629 ot->
description =
"Toggle overwrite while typing";
2651 if (last > 0 && st->
top > last) {
2733 const int mval[2] = {
event->xy[0],
event->xy[1]};
2755 tsc->
state.size_px[1];
2758 for (
int i = 0; i < 2; i += 1) {
2767 int scroll_ofs_new[2] = {
2771 int scroll_ofs_px_new[2] = {
2776 for (
int i = 0; i < 2; i += 1) {
2778 while (scroll_ofs_px_new[i] < 0) {
2779 scroll_ofs_px_new[i] += tsc->
state.size_px[i];
2780 scroll_ofs_new[i] -= 1;
2784 if (scroll_ofs_new[i] < 0) {
2785 scroll_ofs_new[i] = 0;
2786 scroll_ofs_px_new[i] = 0;
2788 else if (scroll_ofs_new[i] >= tsc->
state.ofs_max[i]) {
2789 scroll_ofs_new[i] = tsc->
state.ofs_max[i];
2790 scroll_ofs_px_new[i] = 0;
2796 scroll_ofs_new[0] = 0;
2797 scroll_ofs_px_new[0] = 0;
2801 if (scroll_ofs_new[0] != st->
left || scroll_ofs_new[1] != st->
top ||
2807 st->
left = scroll_ofs_new[0];
2808 st->
top = scroll_ofs_new[1];
2843 switch (event->
type) {
2920 ot->
name =
"Scroll";
2923 ot->
idname =
"TEXT_OT_scroll";
2938 ot->
srna,
"lines", 1, INT_MIN,
INT_MAX,
"Lines",
"Number of lines to scroll", -100, 100);
2971 const int *mval =
event->mval;
3030 ot->
name =
"Scrollbar";
3033 ot->
idname =
"TEXT_OT_scroll_bar";
3047 ot->
srna,
"lines", 1, INT_MIN,
INT_MAX,
"Lines",
"Number of lines to scroll", -100, 100);
3080 while (*(
str + j)) {
3083 if (i + col >
index) {
3105 for (i = -st->
top; i <= *y && linep; linep = linep->next, i += lines) {
3108 if (i + lines > *
y) {
3130 int i = 0, start = 0, end =
max;
3131 int j, curs = 0, endj = 0;
3135 for (j = 0; !found && ((ch = linep->
line[j]) !=
'\0');
3159 if (
y == 0 && i - start <= x && i + columns - start >
x) {
3166 else if (i - end <= x && i + columns - end >
x) {
3169 if (i + columns - start >
max) {
3170 end = std::min(end, i);
3175 if (charp > endj && !chop && ch !=
'\0') {
3187 if (j < linep->
len) {
3192 if (
y == 0 && i + columns - start >
x) {
3198 else if (
ELEM(ch,
' ',
'-',
'\0')) {
3203 if (
y == 0 && i + columns - start >
x) {
3224 linep = st->
text->lines.first();
3228 linep = st->
text->lines.last();
3264 linep = &text->sell;
3265 charp = &text->selc;
3268 linep = &text->curl;
3269 charp = &text->curc;
3276 if ((*linep)->next) {
3277 *linep = (*linep)->
next;
3283 if ((*linep)->prev) {
3284 *linep = (*linep)->
prev;
3294 *charp = (*linep)->len;
3304 if (ssel->
timer ==
nullptr) {
3320 ssel->
timer =
nullptr;
3329 if (event->
mval[1] < 0 || event->
mval[1] > region->
winy) {
3343 st, region, std::clamp(event->
mval[0], 0,
int(region->
winx)), event->
mval[1],
true);
3405 switch (event->
type) {
3431 ot->
name =
"Set Selection";
3432 ot->
idname =
"TEXT_OT_selection_set";
3480 ot->
name =
"Set Cursor";
3481 ot->
idname =
"TEXT_OT_cursor_set";
3507 const int *mval =
event->mval;
3509 static int jump_to = 0;
3510 static double last_jump = 0;
3518 if (!(mval[0] > 2 &&
3520 mval[1] > 2 && mval[1] < region->
winy - 2))
3526 if (!(event_ascii >=
'0' && event_ascii <=
'9')) {
3531 if (last_jump < time - 1) {
3536 jump_to += int(event_ascii -
'0');
3550 ot->
name =
"Line Number";
3551 ot->
idname =
"TEXT_OT_line_number";
3582 if (*
str ==
'\0' || text->curl ==
nullptr) {
3621 bool do_auto_close =
false;
3622 bool do_auto_close_select =
false;
3624 uint auto_close_char_input = 0;
3625 uint auto_close_char_match = 0;
3632 } auto_close_select = {
nullptr}, auto_close_select_backup = {
nullptr};
3634#ifdef WITH_INPUT_IME
3635 if (
const std::optional<wmOperatorStatus> status = WM_operator_IME_insert_maybe(
3636 C, op, event,
"text"))
3661 if (isascii(auto_close_char_input)) {
3663 if (auto_close_char_match != 0) {
3664 do_auto_close =
true;
3669 do_auto_close_select =
true;
3671 auto_close_select_backup.curl = st->
text->curl;
3672 auto_close_select_backup.curc = st->
text->curc;
3673 auto_close_select_backup.sell = st->
text->sell;
3674 auto_close_select_backup.selc = st->
text->selc;
3679 auto_close_select.curl = st->
text->curl;
3680 auto_close_select.curc = st->
text->curc;
3681 auto_close_select.sell = st->
text->sell;
3682 auto_close_select.selc = st->
text->selc;
3693 if (do_auto_close) {
3697 if (do_auto_close_select) {
3699 if (auto_close_select.curl == auto_close_select.sell) {
3700 auto_close_select.selc += auto_close_char_len;
3703 st->
text->curl = auto_close_select.sell;
3704 st->
text->curc = auto_close_select.selc;
3712 if (do_auto_close_select) {
3714 if (auto_close_select.curl != auto_close_select.sell) {
3715 TextLine *line = auto_close_select.curl;
3719 }
while (line != auto_close_select.sell);
3721 st->
text->curl = auto_close_select.curl;
3722 st->
text->curc = auto_close_select.curc + auto_close_char_len;
3723 st->
text->sell = auto_close_select.sell;
3724 st->
text->selc = auto_close_select.selc;
3729 if (do_auto_close_select) {
3730 st->
text->curl = auto_close_select_backup.curl;
3731 st->
text->curc = auto_close_select_backup.curc;
3732 st->
text->sell = auto_close_select_backup.sell;
3733 st->
text->selc = auto_close_select_backup.selc;
3751 ot->
name =
"Insert";
3752 ot->
idname =
"TEXT_OT_insert";
3753 ot->
description =
"Insert text at cursor position";
3765 ot->
srna,
"text",
nullptr, 0,
"Text",
"Text to insert at the cursor position");
3814 if (text->curl && text->curl->format) {
3815 MEM_delete(text->curl->format);
3816 text->curl->format =
nullptr;
3833 if (text->id.next) {
3834 text = st->
text =
static_cast<Text *
>(text->id.next);
3860 ot->
name =
"Find Next";
3861 ot->
idname =
"TEXT_OT_find";
3879 const int flags = st->
flags;
3886 const int orig_curl =
BLI_findindex(&text->lines, text->curl);
3887 const int orig_curc = text->curc;
3898 if (text->curl && text->curl->format) {
3899 MEM_delete(text->curl->format);
3900 text->curl->format =
nullptr;
3929 ot->
name =
"Replace";
3930 ot->
idname =
"TEXT_OT_replace";
3931 ot->
description =
"Replace text with the specified text";
3972 ot->
name =
"Find & Set Selection";
3973 ot->
idname =
"TEXT_OT_find_set_selected";
3974 ot->
description =
"Find specified text and set as selected";
4003 ot->
name =
"Replace & Set Selection";
4004 ot->
idname =
"TEXT_OT_replace_set_selected";
4005 ot->
description =
"Replace text with specified text and set as selected";
4023 const char *filepath,
4024 const int line_index,
4025 const int column_index)
4027 bool success =
false;
4033 const char *expr_imports[] = {
"_bl_text_utils",
"_bl_text_utils.external_editor",
"os",
nullptr};
4036 std::stringstream expr_stream;
4037 expr_stream <<
"_bl_text_utils.external_editor.open_external_editor(os.fsdecode(b'";
4038 for (
const char *ch = filepath; *ch; ch++) {
4039 expr_stream <<
"\\x" << std::hex << int(*ch);
4041 expr_stream <<
"'), " << std::dec << line_index <<
", " << std::dec << column_index <<
")";
4042 expr = expr_stream.str();
4045 char *expr_result =
nullptr;
4048 if (expr_result[0] ==
'\0') {
4056 MEM_delete(expr_result);
4059 UNUSED_VARS(
C, reports, filepath, line_index, column_index);
4066 const char *filepath,
4067 const int line_index,
4068 const int column_index)
4071 Text *text =
nullptr;
4075 if (text_iter.filepath ==
nullptr) {
4078 const char *filepath_iter;
4081 STRNCPY(filepath_iter_buf, text_iter.filepath);
4083 filepath_iter = filepath_iter_buf;
4086 filepath_iter = text_iter.filepath;
4095 if (text ==
nullptr) {
4099 if (text ==
nullptr) {
4104 txt_move_to(text, line_index, column_index,
false);
4126 if (text->filepath !=
nullptr) {
4128 const int line_index =
BLI_findindex(&text->lines, text->curl);
4132 STRNCPY(filepath, text->filepath);
4149 if (filepath[0] ==
'\0') {
4155 printf(
"%s:%d:%d\n", filepath, line_index + 1, column_index);
4158 if (
U.text_editor[0] !=
'\0') {
4160 C, op->
reports, filepath, line_index, column_index);
4164 C, op->
reports, filepath, line_index, column_index);
4175 ot->
name =
"Jump to File at Point";
4176 ot->
idname =
"TEXT_OT_jump_to_file_at_point";
4177 ot->
description =
"Jump to a file for the text editor";
4207 {0,
nullptr, 0,
nullptr,
nullptr},
4218 return ((text->filepath !=
nullptr) && !(text->flags &
TXT_ISMEM));
4226 switch (resolution) {
4252 C,
IFACE_(
"File Modified Outside and Inside Blender"), ICON_NONE);
4253 ui::Layout &layout = *popup_menu_layout(pup);
4255 op->
type,
IFACE_(
"Reload from disk (ignore local changes)"), ICON_NONE);
4257 op_ptr = layout.
op(op->
type,
IFACE_(
"Save to disk (ignore outside changes)"), ICON_NONE);
4259 op_ptr = layout.
op(op->
type,
IFACE_(
"Make text internal (separate copy)"), ICON_NONE);
4261 popup_menu_end(
C, pup);
4265 C,
IFACE_(
"File Modified Outside Blender"), ICON_NONE);
4266 ui::Layout &layout = *popup_menu_layout(pup);
4269 op_ptr = layout.
op(op->
type,
IFACE_(
"Make text internal (separate copy)"), ICON_NONE);
4271 op_ptr = layout.
op(op->
type,
IFACE_(
"Ignore"), ICON_NONE);
4273 popup_menu_end(
C, pup);
4278 C,
IFACE_(
"File Deleted Outside Blender"), ICON_NONE);
4279 ui::Layout &layout = *popup_menu_layout(pup);
4282 op_ptr = layout.
op(op->
type,
IFACE_(
"Recreate file"), ICON_NONE);
4284 popup_menu_end(
C, pup);
4294 ot->
name =
"Resolve Conflict";
4295 ot->
idname =
"TEXT_OT_resolve_conflict";
4296 ot->
description =
"When external text is out of sync, resolve the conflict";
4309 "How to solve conflict due to differences in internal and external text");
4331 ot->
name =
"To 3D Object";
4332 ot->
idname =
"TEXT_OT_to_3d_object";
4333 ot->
description =
"Create 3D text object from active text data-block";
4344 ot->
srna,
"split_lines",
false,
"Split Lines",
"Create one object per line in the text");
4359 if (text ==
nullptr) {
4384 for (
bNode *
node : ntree->all_nodes()) {
4387 if (ngroup && !done_trees.
contains(ngroup)) {
4427 if (cam.custom_shader == text) {
4446 ot->
name =
"Shader Update";
4448 "Update users of this shader, such as custom cameras and script nodes, with its new sockets "
4450 ot->
idname =
"TEXT_OT_update_shader";
#define FOREACH_NODETREE_END
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
File and directory operations.
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
#define BLT_I18NCONTEXT_ID_TEXT
#define ID_BLEND_PATH(_bmain, _id)
Read Blender memory allocation and freeing.
#define UNUSED_VARS_NDEBUG(...)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool contains(const Key &key) const
void add_new(const Key &key)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
void context_active_but_prop_get_templateID(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop)
static bool text_update_shader_poll(bContext *C)
static wmOperatorStatus text_comment_exec(bContext *C, wmOperator *op)
static wmOperatorStatus text_insert_exec(bContext *C, wmOperator *op)
void ED_text_to_object(bContext *C, const Text *text, const bool split_lines)
bool text_space_edit_poll(bContext *C)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static wmOperatorStatus text_resolve_conflict_invoke(bContext *C, wmOperator *op, const wmEvent *)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int flatten_string(const SpaceText *st, FlattenString *fs, const char *in)
void TEXT_OT_delete(wmOperatorType *ot)
struct Text * BKE_text_add(struct Main *bmain, const char *name)
static wmOperatorStatus text_unlink_exec(bContext *C, wmOperator *)
static void text_open_init(bContext *C, wmOperator *op)
static void txt_copy_clipboard(const Text *text)
static wmOperatorStatus text_line_number_invoke(bContext *C, wmOperator *, const wmEvent *event)
ScrArea * CTX_wm_area(const bContext *C)
int txt_get_span(const struct TextLine *from, const struct TextLine *to)
static bool text_new_poll(bContext *)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
char * STRNCPY(char(&dst)[N], const char *src)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
static wmOperatorStatus text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int txt_calc_tab_left(const struct TextLine *tl, int ch)
static bool text_span_is_blank(TextLine *line1, const int line1_char, TextLine *line2, const int line2_char)
void TEXT_OT_new(wmOperatorType *ot)
void BKE_id_delete(Main *bmain, void *idv, const BKEIDDeleteOptions &options={}) ATTR_NONNULL()
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void txt_jump_left(struct Text *text, bool sel, bool use_init_step)
static int flatten_width(SpaceText *st, const char *str)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
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 space_text_drawcache_tag_update(SpaceText *st, const bool full)
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
static char * buf_tabs_to_spaces(const char *in_buf, const int tab_size, int *r_out_buf_len)
static wmOperatorStatus text_reload_exec(bContext *C, wmOperator *op)
void TEXT_OT_indent_or_autocomplete(wmOperatorType *ot)
void TEXT_OT_make_internal(wmOperatorType *ot)
static wmOperatorStatus text_select_all_exec(bContext *C, wmOperator *)
void text_update_line_edited(TextLine *line)
static wmOperatorStatus text_select_line_exec(bContext *C, wmOperator *)
PointerRNA RNA_id_pointer_create(ID *id)
static wmOperatorStatus text_open_exec(bContext *C, wmOperator *op)
int BLI_str_utf8_char_width_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void txt_move_eof(struct Text *text, bool sel)
void TEXT_OT_cursor_set(wmOperatorType *ot)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
static wmOperatorStatus text_move_select_exec(bContext *C, wmOperator *op)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static wmOperatorStatus text_line_break_exec(bContext *C, wmOperator *)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static wmOperatorStatus text_new_exec(bContext *C, wmOperator *)
static wmOperatorStatus text_unindent_exec(bContext *C, wmOperator *)
static wmOperatorStatus text_find_set_selected_exec(bContext *C, wmOperator *op)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void TEXT_OT_to_3d_object(wmOperatorType *ot)
static wmOperatorStatus text_indent_or_autocomplete_exec(bContext *C, wmOperator *)
bool BKE_text_reload(struct Text *text)
void TEXT_OT_scroll_bar(wmOperatorType *ot)
void space_text_update_cursor_moved(bContext *C)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
static wmOperatorStatus text_replace_exec(bContext *C, wmOperator *op)
void TEXT_OT_resolve_conflict(wmOperatorType *ot)
int RNA_int_get(PointerRNA *ptr, const char *name)
void TEXT_OT_select_all(wmOperatorType *ot)
void txt_backspace_char(struct Text *text)
char WM_event_utf8_to_ascii(const wmEvent *event)
wmWindow * CTX_wm_window(const bContext *C)
static wmOperatorStatus move_lines_exec(bContext *C, wmOperator *op)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void TEXT_OT_convert_whitespace(wmOperatorType *ot)
static void text_scroll_cancel(bContext *C, wmOperator *op)
MINLINE int max_ii(int a, int b)
static wmOperatorStatus text_selection_set_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void txt_move_bof(struct Text *text, bool sel)
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
bool txt_has_sel(const struct Text *text)
static int flatten_column_to_offset(SpaceText *st, const char *str, int index)
bool bool BPY_run_text(bContext *C, Text *text, ReportList *reports, bool do_jump) ATTR_NONNULL(1
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
RenderEngineType * CTX_data_engine_type(const bContext *C)
Text * CTX_data_edit_text(const bContext *C)
static void space_text_cursor_skip(const SpaceText *st, const ARegion *region, Text *text, int lines, const bool sel)
bool ED_text_activate_in_screen(bContext *C, Text *text)
int space_text_get_total_lines(SpaceText *st, const ARegion *region)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
void TEXT_OT_duplicate_line(wmOperatorType *ot)
static const EnumPropertyItem resolution_items[]
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
static wmOperatorStatus text_replace_all(bContext *C)
static wmOperatorStatus text_find_exec(bContext *C, wmOperator *op)
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)
static void space_text_screen_skip(SpaceText *st, ARegion *region, int lines)
static bool text_scroll_poll(bContext *C)
static const EnumPropertyItem whitespace_type_items[]
static void text_update_edited(bContext *C, Object *obedit, const eEditFontMode mode)
void txt_move_toline(struct Text *text, unsigned int line, bool sel)
void TEXT_OT_unindent(wmOperatorType *ot)
void ED_space_text_scroll_to_cursor(SpaceText *st, ARegion *region, bool center)
static bool text_jump_to_file_at_point_internal(bContext *C, ReportList *reports, const char *filepath, const int line_index, const int column_index)
static void scroll_exit(bContext *C, wmOperator *op)
void RE_engine_free(RenderEngine *engine)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void TEXT_OT_update_shader(wmOperatorType *ot)
static void text_scroll_apply(bContext *C, wmOperator *op, const wmEvent *event)
static void text_selection_set_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus text_save_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus text_to_3d_object_exec(bContext *C, wmOperator *op)
bool txt_cursor_is_line_start(const struct Text *text)
SpaceText * CTX_wm_space_text(const bContext *C)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool txt_unindent(struct Text *text)
static wmOperatorStatus text_make_internal_exec(bContext *C, wmOperator *)
static wmOperatorStatus text_select_word_exec(bContext *C, wmOperator *)
void TEXT_OT_save(wmOperatorType *ot)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case)
static int space_text_get_cursor_rel(const SpaceText *st, const ARegion *region, TextLine *linein, int rell, int relc)
static bool text_region_edit_poll(bContext *C)
void flatten_string_free(FlattenString *fs)
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)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
void TEXT_OT_line_break(wmOperatorType *ot)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
int txt_calc_tab_right(const struct TextLine *tl, int ch)
static wmOperatorStatus text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void TEXT_OT_select_word(wmOperatorType *ot)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
static int cursor_skip_find_line(const SpaceText *st, const ARegion *region, int lines, TextLine **linep, int *charp, int *rell, int *relc)
static wmOperatorStatus text_find_and_replace(bContext *C, wmOperator *op, short mode)
void BKE_report(ReportList *reports, eReportType type, const char *message)
static void txt_wrap_move_eol(SpaceText *st, ARegion *region, const bool sel)
int txt_setcurr_tab_spaces(struct Text *text, int space)
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 TEXT_OT_unlink(wmOperatorType *ot)
void txt_pop_sel(struct Text *text)
static wmOperatorStatus text_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *)
wmWindowManager * CTX_wm_manager(const bContext *C)
static wmOperatorStatus text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int space_text_get_char_pos(const SpaceText *st, const char *line, int cur)
static void test_line_start(char c, bool *r_last_state)
static wmOperatorStatus text_move_cursor(bContext *C, int type, bool select)
void txt_sel_all(struct Text *text)
void txt_move_lines(struct Text *text, int direction)
void TEXT_OT_jump(wmOperatorType *ot)
int space_text_wrap_width(const SpaceText *st, const ARegion *region)
void void txt_split_curline(struct Text *text)
void TEXT_OT_scroll(wmOperatorType *ot)
void TEXT_OT_replace(wmOperatorType *ot)
static const EnumPropertyItem move_type_items[]
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void TEXT_OT_comment_toggle(wmOperatorType *ot)
static void txt_wrap_move_down(SpaceText *st, ARegion *region, const bool sel)
void txt_delete_selected(struct Text *text)
@ USER_TEXT_EDIT_AUTO_CLOSE
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
void TEXT_OT_replace_set_selected(wmOperatorType *ot)
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)
void TEXT_OT_jump_to_file_at_point(wmOperatorType *ot)
bool BLI_file_is_writable(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void TEXT_OT_cut(wmOperatorType *ot)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static wmOperatorStatus text_reload_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus text_update_shader_exec(bContext *C, wmOperator *op)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message, const bool show_icon)
int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, const char *str)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus text_delete_exec(bContext *C, wmOperator *op)
wmOperatorStatus WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, ui::AlertIcon icon, bool cancel_default)
void TEXT_OT_select_line(wmOperatorType *ot)
static wmOperatorStatus text_resolve_conflict_exec(bContext *C, wmOperator *op)
static wmOperatorStatus text_jump_exec(bContext *C, wmOperator *op)
void TEXT_OT_open(wmOperatorType *ot)
void txt_move_left(struct Text *text, bool sel)
const char * ED_text_format_comment_line_prefix(Text *text)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void txt_move_down(struct Text *text, bool sel)
char * txt_sel_to_buf(const struct Text *text, size_t *r_buf_strlen)
void TEXT_OT_move_lines(wmOperatorType *ot)
static wmOperatorStatus text_run_script(bContext *C, ReportList *reports)
int RNA_string_length(PointerRNA *ptr, const char *name)
bool txt_uncomment(struct Text *text, const char *prefix)
BLI_INLINE int space_text_pixel_x_to_column(const SpaceText *st, const int x)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
static wmOperatorStatus text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
void int BKE_text_file_modified_check(const struct Text *text)
static void text_cursor_set_exit(bContext *C, wmOperator *op)
@ WM_CAPABILITY_CLIPBOARD_PRIMARY
static void text_cursor_timer_remove(bContext *C, SetSelection *ssel)
void TEXT_OT_selection_set(wmOperatorType *ot)
static bool text_data_poll(bContext *C)
void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void txt_move_right(struct Text *text, bool sel)
static bool text_resolve_conflict_poll(bContext *C)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *event)
RenderEngine * RE_engine_create(RenderEngineType *type)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
const char * BLI_str_find_prev_char_utf8(const char *p, const char *str_start) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
static wmOperatorStatus text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *)
void txt_sel_line(struct Text *text)
static wmOperatorStatus text_scroll_exec(bContext *C, wmOperator *op)
Main * CTX_data_main(const bContext *C)
void txt_move_bol(struct Text *text, bool sel)
void TEXT_OT_find_set_selected(wmOperatorType *ot)
void txt_move_up(struct Text *text, bool sel)
void TEXT_OT_find(wmOperatorType *ot)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void TEXT_OT_move_select(wmOperatorType *ot)
char * WM_clipboard_text_get(bool selection, bool ensure_utf8, int *r_len)
static void txt_wrap_move_up(SpaceText *st, ARegion *region, const bool sel)
UndoStep * ED_text_undo_push_init(bContext *C)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
eWM_CapabilitiesFlag WM_capabilities_flag()
void TEXT_OT_indent(wmOperatorType *ot)
void space_text_wrap_offset_in_line(const SpaceText *st, const ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
void WM_clipboard_text_set(const char *buf, bool selection)
static void space_text_screen_clamp(SpaceText *st, const ARegion *region)
static wmOperatorStatus text_indent_exec(bContext *C, wmOperator *)
struct Text struct Text * BKE_text_load(struct Main *bmain, const char *filepath, const char *relbase) ATTR_NONNULL(1
static wmOperatorStatus text_cut_exec(bContext *C, wmOperator *)
static TextLine * space_text_get_line_pos_wrapped(const SpaceText *st, const ARegion *region, int *y)
static bool text_update_shader_text_recursive(RenderEngine *engine, RenderEngineType *type, bNodeTree *ntree, Text *text, VectorSet< bNodeTree * > &done_trees)
static bool text_unlink_poll(bContext *C)
static char text_closing_character_pair_get(const char character)
unsigned int BLI_str_utf8_as_unicode_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
unsigned int unsigned int size_t BLI_str_utf8_from_unicode_len(unsigned int c) ATTR_WARN_UNUSED_RESULT
static bool text_edit_poll(bContext *C)
static wmOperatorStatus text_replace_set_selected_exec(bContext *C, wmOperator *)
static void text_cursor_set_to_pos(SpaceText *st, const ARegion *region, int x, int y, const bool sel)
double BLI_time_now_seconds()
void txt_jump_right(struct Text *text, bool sel, bool use_init_step)
int BLI_str_utf8_offset_to_index(const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void text_cursor_timer_ensure(bContext *C, SetSelection *ssel)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
void TEXT_OT_move(wmOperatorType *ot)
static void text_open_cancel(bContext *, wmOperator *op)
void TEXT_OT_paste(wmOperatorType *ot)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
static void space_text_cursor_set_to_pos_wrapped(const SpaceText *st, const ARegion *region, int x, int y, const bool sel)
void txt_delete_char(struct Text *text)
static wmOperatorStatus text_jump_invoke(bContext *C, wmOperator *op, const wmEvent *)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
void txt_move_eol(struct Text *text, bool sel)
void BKE_text_file_modified_ignore(struct Text *text)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static bool text_region_scroll_poll(bContext *C)
static wmOperatorStatus text_selection_set_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus text_copy_exec(bContext *C, wmOperator *)
static wmOperatorStatus text_move_exec(bContext *C, wmOperator *op)
static wmOperatorStatus text_jump_to_file_at_point_exec(bContext *C, wmOperator *op)
static void text_select_update_primary_clipboard(const Text *text)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void txt_order_cursors(struct Text *text, bool reverse)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void TEXT_OT_insert(wmOperatorType *ot)
static wmOperatorStatus text_convert_whitespace_exec(bContext *C, wmOperator *op)
void TEXT_OT_reload(wmOperatorType *ot)
static wmOperatorStatus text_save_exec(bContext *C, wmOperator *op)
static wmOperatorStatus text_duplicate_line_exec(bContext *C, wmOperator *)
void space_text_update_character_width(SpaceText *st)
static wmOperatorStatus text_save_as_exec(bContext *C, wmOperator *op)
ARegion * CTX_wm_region(const bContext *C)
void txt_backspace_word(struct Text *text)
static wmOperatorStatus text_toggle_overwrite_exec(bContext *C, wmOperator *)
static wmOperatorStatus text_open_invoke(bContext *C, wmOperator *op, const wmEvent *)
void txt_move_to(struct Text *text, unsigned int line, unsigned int ch, bool sel)
static wmOperatorStatus text_paste_exec(bContext *C, wmOperator *op)
@ SCROLLHANDLE_INVALID_OUTSIDE
@ SCROLLHANDLE_MIN_OUTSIDE
@ SCROLLHANDLE_MAX_OUTSIDE
static const EnumPropertyItem delete_type_items[]
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
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)
static void txt_wrap_move_bol(SpaceText *st, ARegion *region, const bool sel)
void TEXT_OT_copy(wmOperatorType *ot)
bool txt_replace_char(struct Text *text, unsigned int add)
static wmOperatorStatus text_run_script_exec(bContext *C, wmOperator *op)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void TEXT_OT_run_script(wmOperatorType *ot)
static wmOperatorStatus text_cursor_set_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool text_jump_to_file_at_point_external(bContext *C, ReportList *reports, const char *filepath, const int line_index, const int column_index)
bool bool bool bool BPY_run_string_as_string(bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value) ATTR_NONNULL(1
static wmOperatorStatus text_cursor_set_exec(bContext *C, wmOperator *op)
void ED_area_tag_redraw(ScrArea *area)
static void text_scroll_state_init(TextScroll *tsc, SpaceText *st, ARegion *region)
void TEXT_OT_save_as(wmOperatorType *ot)
void BLI_str_cursor_step_bounds_utf8(const char *str, int str_maxlen, int pos, int *r_start, int *r_end)
void TEXT_OT_line_number(wmOperatorType *ot)
const char * report_prefix
ListBaseT< Camera > cameras
void(*) update_custom_camera(struct RenderEngine *engine, struct Camera *cam)
void(*) update_script_node(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
struct ReportList * reports
ed::text::SpaceText_Runtime * runtime
struct blender::TextScroll::@246337252063272151263115240064276077065264016304 state
rcti scroll_region_handle
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
wmEventModifierFlag modifier
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
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 ReportList * reports
struct wmOperatorType * type
#define TXT_LINE_HEIGHT(st)
#define TXT_NUMCOL_WIDTH(st)
#define TXT_BODY_LEFT(st)