|
Blender
V2.93
|
#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <sys/types.h>#include <wctype.h>#include "MEM_guardedalloc.h"#include "BLI_fileops.h"#include "BLI_listbase.h"#include "BLI_path_util.h"#include "BLI_string.h"#include "BLI_string_cursor_utf8.h"#include "BLI_string_utf8.h"#include "BLI_utildefines.h"#include "BLT_translation.h"#include "DNA_constraint_types.h"#include "DNA_material_types.h"#include "DNA_node_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_text_types.h"#include "DNA_userdef_types.h"#include "BKE_idtype.h"#include "BKE_lib_id.h"#include "BKE_main.h"#include "BKE_node.h"#include "BKE_text.h"#include "BLO_read_write.h"Go to the source code of this file.
Functions | |
Prototypes | |
| static void | txt_pop_first (Text *text) |
| static void | txt_pop_last (Text *text) |
| static void | txt_delete_line (Text *text, TextLine *line) |
| static void | txt_delete_sel (Text *text) |
| static void | txt_make_dirty (Text *text) |
Text Add, Free, Validation | |
| void | BKE_text_free_lines (Text *text) |
| Text * | BKE_text_add (Main *bmain, const char *name) |
| int | txt_extended_ascii_as_utf8 (char **str) |
| static void | cleanup_textline (TextLine *tl) |
| static void | text_from_buf (Text *text, const unsigned char *buffer, const int len) |
| bool | BKE_text_reload (Text *text) |
| Text * | BKE_text_load_ex (Main *bmain, const char *file, const char *relpath, const bool is_internal) |
| Text * | BKE_text_load (Main *bmain, const char *file, const char *relpath) |
| void | BKE_text_clear (Text *text) |
| void | BKE_text_write (Text *text, const char *str) |
| int | BKE_text_file_modified_check (Text *text) |
| void | BKE_text_file_modified_ignore (Text *text) |
Editing Utility Functions | |
| static void | make_new_line (TextLine *line, char *newline) |
| static TextLine * | txt_new_line (const char *str) |
| static TextLine * | txt_new_linen (const char *str, int n) |
| void | txt_clean_text (Text *text) |
| int | txt_get_span (TextLine *from, TextLine *to) |
Cursor Utility Functions | |
| static void | txt_curs_cur (Text *text, TextLine ***linep, int **charp) |
| static void | txt_curs_sel (Text *text, TextLine ***linep, int **charp) |
| bool | txt_cursor_is_line_start (Text *text) |
| bool | txt_cursor_is_line_end (Text *text) |
Cursor Movement Functions | |
| |
| void | txt_move_up (Text *text, const bool sel) |
| void | txt_move_down (Text *text, const bool sel) |
| int | txt_calc_tab_left (TextLine *tl, int ch) |
| int | txt_calc_tab_right (TextLine *tl, int ch) |
| void | txt_move_left (Text *text, const bool sel) |
| void | txt_move_right (Text *text, const bool sel) |
| void | txt_jump_left (Text *text, const bool sel, const bool use_init_step) |
| void | txt_jump_right (Text *text, const bool sel, const bool use_init_step) |
| void | txt_move_bol (Text *text, const bool sel) |
| void | txt_move_eol (Text *text, const bool sel) |
| void | txt_move_bof (Text *text, const bool sel) |
| void | txt_move_eof (Text *text, const bool sel) |
| void | txt_move_toline (Text *text, unsigned int line, const bool sel) |
| void | txt_move_to (Text *text, unsigned int line, unsigned int ch, const bool sel) |
Text Selection Functions | |
| static void | txt_curs_swap (Text *text) |
| void | txt_pop_sel (Text *text) |
| void | txt_order_cursors (Text *text, const bool reverse) |
| bool | txt_has_sel (Text *text) |
| void | txt_sel_all (Text *text) |
| void | txt_sel_clear (Text *text) |
| void | txt_sel_line (Text *text) |
| void | txt_sel_set (Text *text, int startl, int startc, int endl, int endc) |
Buffer Conversion for Undo/Redo | |
Buffer conversion functions that rely on the buffer already being validated. The only requirement for these functions is that they're reverse-able, the undo logic doesn't inspect their content. Currently buffers:
| |
| char * | txt_to_buf_for_undo (Text *text, int *r_buf_len) |
| void | txt_from_buf_for_undo (Text *text, const char *buf, int buf_len) |
Cut and Paste Functions | |
| char * | txt_to_buf (Text *text, int *r_buf_strlen) |
| char * | txt_sel_to_buf (Text *text, int *r_buf_strlen) |
| void | txt_insert_buf (Text *text, const char *in_buffer) |
Find String in Text | |
| int | txt_find_string (Text *text, const char *findstr, int wrap, int match_case) |
Character Queries | |
| int | text_check_bracket (const char ch) |
| bool | text_check_delim (const char ch) |
| bool | text_check_digit (const char ch) |
| bool | text_check_identifier (const char ch) |
| bool | text_check_identifier_nodigit (const char ch) |
| int | text_check_identifier_unicode (const unsigned int ch) |
| int | text_check_identifier_nodigit_unicode (const unsigned int ch) |
| bool | text_check_whitespace (const char ch) |
| int | text_find_identifier_start (const char *str, int i) |
Text Data-Block | |
| IDTypeInfo | IDType_ID_TXT |
| static void | text_init_data (ID *id) |
| static void | text_copy_data (Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag)) |
| static void | text_free_data (ID *id) |
| static void | text_blend_write (BlendWriter *writer, ID *id, const void *id_address) |
| static void | text_blend_read_data (BlendDataReader *reader, ID *id) |
Line Editing Functions | |
| static char | tab_to_spaces [] = " " |
| void | txt_split_curline (Text *text) |
| static void | txt_combine_lines (Text *text, TextLine *linea, TextLine *lineb) |
| void | txt_duplicate_line (Text *text) |
| void | txt_delete_char (Text *text) |
| void | txt_delete_word (Text *text) |
| void | txt_backspace_char (Text *text) |
| void | txt_backspace_word (Text *text) |
| static void | txt_convert_tab_to_spaces (Text *text) |
| static bool | txt_add_char_intern (Text *text, unsigned int add, bool replace_tabs) |
| bool | txt_add_char (Text *text, unsigned int add) |
| bool | txt_add_raw_char (Text *text, unsigned int add) |
| void | txt_delete_selected (Text *text) |
| bool | txt_replace_char (Text *text, unsigned int add) |
| static void | txt_select_prefix (Text *text, const char *add, bool skip_blank_lines) |
| static bool | txt_select_unprefix (Text *text, const char *remove, const bool require_all) |
| void | txt_comment (Text *text) |
| bool | txt_uncomment (Text *text) |
| void | txt_indent (Text *text) |
| bool | txt_unindent (Text *text) |
| void | txt_move_lines (struct Text *text, const int direction) |
| int | txt_setcurr_tab_spaces (Text *text, int space) |
Definition at line 292 of file text.c.
References BKE_id_new(), Text::id, id_fake_user_set(), ID_TXT, and id_us_min().
Referenced by text_new_exec().
| void BKE_text_clear | ( | Text * | text | ) |
Definition at line 538 of file text.c.
References txt_delete_sel(), txt_make_dirty(), and txt_sel_all().
| int BKE_text_file_modified_check | ( | Text * | text | ) |
Definition at line 557 of file text.c.
References BLI_exists(), BLI_path_abs(), BLI_stat(), BLI_strncpy(), file, FILE_MAX, Text::filepath, Text::id, ID_BLEND_PATH_FROM_GLOBAL, Text::mtime, and result.
Referenced by text_resolve_conflict_invoke().
| void BKE_text_file_modified_ignore | ( | Text * | text | ) |
Definition at line 591 of file text.c.
References BLI_exists(), BLI_path_abs(), BLI_stat(), BLI_strncpy(), file, FILE_MAX, Text::filepath, Text::id, ID_BLEND_PATH_FROM_GLOBAL, Text::mtime, and result.
Referenced by text_resolve_conflict_exec().
| void BKE_text_free_lines | ( | Text * | text | ) |
compiled member. Definition at line 276 of file text.c.
References BLI_listbase_clear(), Text::curl, ListBase::first, Text::lines, MEM_freeN, NULL, and Text::sell.
Referenced by BKE_text_reload(), and text_free_data().
Load a text file.
Definition at line 533 of file text.c.
References BKE_text_load_ex(), and file.
Referenced by Freestyle::PythonInterpreter::interpretFile().
| Text* BKE_text_load_ex | ( | Main * | bmain, |
| const char * | file, | ||
| const char * | relpath, | ||
| const bool | is_internal | ||
| ) |
Load a text file.
| is_internal | If true, this text data-block only exists in memory, not as a file on disk. |
Definition at line 476 of file text.c.
References BKE_libblock_alloc(), BLI_file_read_text_as_mem(), BLI_listbase_clear(), BLI_path_abs(), BLI_path_basename(), BLI_stat(), BLI_strncpy(), buffer, Text::curl, file, FILE_MAX, Text::filepath, Text::flags, Text::id, id_fake_user_set(), ID_TXT, id_us_min(), Text::lines, MEM_freeN, MEM_mallocN, Text::mtime, NULL, Text::sell, text_from_buf(), TXT_ISDIRTY, TXT_ISMEM, TXT_TABSTOSPACES, and USER_TXT_TABSTOSPACES_DISABLE.
Referenced by BKE_text_load(), and text_open_exec().
| bool BKE_text_reload | ( | Text * | text | ) |
Definition at line 431 of file text.c.
References BKE_text_free_lines(), BLI_file_read_text_as_mem(), BLI_path_abs(), BLI_stat(), BLI_strncpy(), buffer, FILE_MAX, Text::filepath, Text::id, ID_BLEND_PATH_FROM_GLOBAL, MEM_freeN, Text::mtime, NULL, text_from_buf(), and txt_make_dirty().
Referenced by text_blend_read_data(), and text_reload_exec().
| void BKE_text_write | ( | Text * | text, |
| const char * | str | ||
| ) |
Definition at line 545 of file text.c.
References str, txt_insert_buf(), txt_make_dirty(), and txt_move_eof().
|
static |
Definition at line 350 of file text.c.
References TextLine::len, TextLine::line, and txt_extended_ascii_as_utf8().
Referenced by text_from_buf().
|
static |
Definition at line 623 of file text.c.
References TextLine::format, TextLine::len, TextLine::line, MEM_freeN, and NULL.
Referenced by txt_add_char_intern(), txt_combine_lines(), txt_delete_sel(), and txt_select_prefix().
|
static |
Definition at line 207 of file text.c.
References BKE_text_reload(), BLO_read_data_address, BLO_read_list(), Text::compiled, Text::curl, Text::filepath, Text::flags, Text::lines, LISTBASE_FOREACH, NULL, Text::sell, and TXT_ISEXT.
|
static |
Definition at line 172 of file text.c.
References BKE_id_blend_write(), BLO_write_id_struct, BLO_write_is_undo(), BLO_write_raw(), BLO_write_string(), BLO_write_struct, Text::compiled, Text::filepath, Text::flags, id, Text::id, Text::lines, LISTBASE_FOREACH, NULL, TXT_ISEXT, TXT_ISMEM, and ID::us.
| int text_check_bracket | ( | const char | ch | ) |
Definition at line 2383 of file text.c.
References Freestyle::a.
| bool text_check_delim | ( | const char | ch | ) |
Definition at line 2402 of file text.c.
References Freestyle::a.
Referenced by txtfmt_lua_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), and txtfmt_py_format_line().
| bool text_check_digit | ( | const char | ch | ) |
Definition at line 2415 of file text.c.
Referenced by txtfmt_lua_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), txtfmt_py_find_numeral_inner(), and txtfmt_py_literal_numeral().
| bool text_check_identifier | ( | const char | ch | ) |
Definition at line 2426 of file text.c.
Referenced by text_check_identifier_unicode(), text_find_identifier_start(), txtfmt_ini_find_bool(), txtfmt_ini_find_keyword(), txtfmt_ini_find_reserved(), txtfmt_lua_find_bool(), txtfmt_lua_find_keyword(), txtfmt_lua_find_specialvar(), txtfmt_osl_find_builtinfunc(), txtfmt_osl_find_preprocessor(), txtfmt_osl_find_reserved(), txtfmt_osl_find_specialvar(), txtfmt_pov_find_bool(), txtfmt_pov_find_keyword(), txtfmt_pov_find_reserved_builtins(), txtfmt_pov_find_reserved_keywords(), txtfmt_pov_find_specialvar(), txtfmt_py_find_bool(), txtfmt_py_find_builtinfunc(), txtfmt_py_find_decorator(), and txtfmt_py_find_specialvar().
| bool text_check_identifier_nodigit | ( | const char | ch | ) |
Definition at line 2449 of file text.c.
Referenced by text_check_identifier_nodigit_unicode().
| int text_check_identifier_nodigit_unicode | ( | const unsigned int | ch | ) |
| bool text_check_whitespace | ( | const char | ch | ) |
Definition at line 2481 of file text.c.
References ELEM.
Referenced by text_autocomplete_modal(), txtfmt_osl_find_preprocessor(), and txtfmt_py_find_decorator().
|
static |
Only copy internal data of Text ID from source to already allocated/initialized destination. You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
WARNING! This function will not handle ID user count!
| flag | Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). |
Definition at line 124 of file text.c.
References BLI_addtail(), BLI_listbase_clear(), BLI_strdup(), Text::compiled, Text::curc, Text::curl, Text::filepath, ListBase::first, Text::flags, TextLine::format, TextLine::len, TextLine::line, Text::lines, LISTBASE_FOREACH, MEM_mallocN, NULL, Text::selc, Text::sell, and TXT_ISDIRTY.
| int text_find_identifier_start | ( | const char * | str, |
| int | i | ||
| ) |
Definition at line 2489 of file text.c.
References str, text_check_identifier(), and UNLIKELY.
Referenced by confirm_suggestion(), get_suggest_prefix(), and text_autocomplete_build().
|
static |
Free (or release) any data used by this text (does not free the text itself).
Definition at line 159 of file text.c.
References BKE_text_free_lines(), BPY_text_free_code(), Text::filepath, and MEM_SAFE_FREE.
|
static |
used for load and reload (unlike txt_insert_buf) assumes all fields are empty
Definition at line 368 of file text.c.
References BLI_addtail(), BLI_assert, BLI_listbase_is_empty(), buffer, cleanup_textline(), Text::curc, Text::curl, ListBase::first, TextLine::format, len, TextLine::len, TextLine::line, Text::lines, MEM_mallocN, NULL, Text::selc, and Text::sell.
Referenced by BKE_text_load_ex(), and BKE_text_reload().
|
static |
Definition at line 80 of file text.c.
References BLI_addhead(), BLI_assert, BLI_listbase_clear(), Text::curc, Text::curl, Text::filepath, ListBase::first, Text::flags, TextLine::format, TextLine::len, TextLine::line, Text::lines, MEM_mallocN, MEMCMP_STRUCT_AFTER_IS_ZERO, TextLine::next, NULL, TextLine::prev, Text::selc, Text::sell, TXT_ISDIRTY, TXT_ISMEM, TXT_TABSTOSPACES, and USER_TXT_TABSTOSPACES_DISABLE.
| bool txt_add_char | ( | Text * | text, |
| unsigned int | add | ||
| ) |
Definition at line 2028 of file text.c.
References add(), Text::flags, txt_add_char_intern(), and TXT_TABSTOSPACES.
Referenced by text_indent_exec(), text_insert_exec(), text_line_break_exec(), and txt_replace_char().
|
static |
Definition at line 1985 of file text.c.
References add(), BLI_str_utf8_from_unicode(), BLI_UTF8_MAX, Text::curc, Text::curl, TextLine::len, TextLine::line, make_new_line(), MEM_mallocN, txt_clean_text(), txt_convert_tab_to_spaces(), txt_delete_sel(), txt_make_dirty(), txt_pop_sel(), and txt_split_curline().
Referenced by txt_add_char(), and txt_add_raw_char().
| bool txt_add_raw_char | ( | Text * | text, |
| unsigned int | add | ||
| ) |
Definition at line 2033 of file text.c.
References add(), and txt_add_char_intern().
Referenced by txt_insert_buf().
| void txt_backspace_char | ( | Text * | text | ) |
Definition at line 1918 of file text.c.
References BLI_str_prev_char_utf8(), BLI_str_utf8_as_unicode_and_size(), Freestyle::c, Text::curc, Text::curl, TextLine::len, TextLine::line, TextLine::next, TextLine::prev, txt_clean_text(), txt_combine_lines(), txt_delete_sel(), txt_has_sel(), txt_make_dirty(), txt_pop_sel(), and UNUSED_VARS.
Referenced by text_delete_exec().
| void txt_backspace_word | ( | Text * | text | ) |
Definition at line 1963 of file text.c.
References txt_delete_sel(), txt_jump_left(), and txt_make_dirty().
Referenced by text_delete_exec().
| int txt_calc_tab_left | ( | TextLine * | tl, |
| int | ch | ||
| ) |
Definition at line 864 of file text.c.
References TextLine::line, and TXT_TABSIZE.
Referenced by text_delete_exec(), and txt_move_left().
| int txt_calc_tab_right | ( | TextLine * | tl, |
| int | ch | ||
| ) |
Definition at line 884 of file text.c.
References TextLine::line, and TXT_TABSIZE.
Referenced by text_delete_exec(), and txt_move_right().
| void txt_clean_text | ( | Text * | text | ) |
Definition at line 673 of file text.c.
References Text::curc, Text::curl, ListBase::first, ListBase::last, Text::lines, TextLine::next, NULL, Text::selc, Text::sell, top, and txt_new_line().
Referenced by txt_add_char_intern(), txt_backspace_char(), txt_combine_lines(), txt_delete_char(), txt_delete_line(), txt_duplicate_line(), txt_move_lines(), txt_replace_char(), txt_select_prefix(), txt_select_unprefix(), and txt_split_curline().
Definition at line 1831 of file text.c.
References BLI_strcpy_rlen(), TextLine::len, TextLine::line, make_new_line(), MEM_mallocN, txt_clean_text(), txt_delete_line(), and txt_make_dirty().
Referenced by txt_backspace_char(), and txt_delete_char().
| void txt_comment | ( | Text * | text | ) |
Definition at line 2244 of file text.c.
References Text::curl, ELEM, NULL, Text::sell, txt_has_sel(), and txt_select_prefix().
Referenced by text_comment_exec().
|
static |
Definition at line 1975 of file text.c.
References Text::curc, tab_to_spaces, txt_insert_buf(), and TXT_TABSIZE.
Referenced by txt_add_char_intern().
Definition at line 772 of file text.c.
References Text::curc, and Text::curl.
Referenced by txt_jump_left(), txt_jump_right(), txt_move_bof(), txt_move_bol(), txt_move_down(), txt_move_eof(), txt_move_eol(), txt_move_left(), txt_move_right(), txt_move_to(), and txt_move_up().
Definition at line 778 of file text.c.
References Text::selc, and Text::sell.
Referenced by txt_jump_left(), txt_jump_right(), txt_move_bof(), txt_move_bol(), txt_move_down(), txt_move_eof(), txt_move_eol(), txt_move_left(), txt_move_right(), txt_move_to(), and txt_move_up().
|
static |
Definition at line 1178 of file text.c.
References Text::curc, Text::curl, Text::selc, and Text::sell.
Referenced by txt_order_cursors(), txt_pop_first(), and txt_pop_last().
| bool txt_cursor_is_line_end | ( | Text * | text | ) |
Definition at line 789 of file text.c.
References TextLine::len, Text::selc, and Text::sell.
Referenced by text_delete_exec(), and text_move_cursor().
| bool txt_cursor_is_line_start | ( | Text * | text | ) |
Definition at line 784 of file text.c.
References Text::selc.
Referenced by text_delete_exec(), and text_move_cursor().
| void txt_delete_char | ( | Text * | text | ) |
Definition at line 1871 of file text.c.
References BLI_str_utf8_as_unicode_and_size(), Freestyle::c, Text::curc, Text::curl, TextLine::len, TextLine::line, TextLine::next, txt_clean_text(), txt_combine_lines(), txt_delete_sel(), txt_has_sel(), txt_make_dirty(), txt_pop_sel(), and UNUSED_VARS.
Referenced by text_delete_exec().
Definition at line 1810 of file text.c.
References BLI_remlink(), Text::curl, TextLine::format, TextLine::line, Text::lines, MEM_freeN, txt_clean_text(), and txt_make_dirty().
Referenced by txt_combine_lines(), and txt_delete_sel().
|
static |
Definition at line 1247 of file text.c.
References Text::curc, Text::curl, TextLine::len, TextLine::line, make_new_line(), MEM_mallocN, TextLine::next, TextLine::prev, Text::selc, Text::sell, txt_delete_line(), txt_has_sel(), and txt_order_cursors().
Referenced by BKE_text_clear(), txt_add_char_intern(), txt_backspace_char(), txt_backspace_word(), txt_delete_char(), txt_delete_selected(), txt_delete_word(), txt_insert_buf(), and txt_split_curline().
| void txt_delete_selected | ( | Text * | text | ) |
Definition at line 2038 of file text.c.
References txt_delete_sel(), and txt_make_dirty().
Referenced by text_cut_exec().
| void txt_delete_word | ( | Text * | text | ) |
Definition at line 1911 of file text.c.
References txt_delete_sel(), txt_jump_right(), and txt_make_dirty().
Referenced by text_delete_exec().
| void txt_duplicate_line | ( | Text * | text | ) |
Definition at line 1854 of file text.c.
References BLI_insertlinkafter(), Text::curl, TextLine::line, Text::lines, Text::sell, txt_clean_text(), txt_make_dirty(), and txt_new_line().
Referenced by text_duplicate_line_exec().
| int txt_extended_ascii_as_utf8 | ( | char ** | str | ) |
Definition at line 307 of file text.c.
References BLI_str_utf8_from_unicode(), BLI_utf8_invalid_byte(), length(), MEM_freeN, MEM_mallocN, and str.
Referenced by blo_do_versions_260(), cleanup_textline(), and txt_insert_buf().
| int txt_find_string | ( | Text * | text, |
| const char * | findstr, | ||
| int | wrap, | ||
| int | match_case | ||
| ) |
Definition at line 1704 of file text.c.
References BLI_strcasestr(), Text::curl, ListBase::first, TextLine::line, Text::lines, TextLine::next, NULL, Text::selc, Text::sell, txt_get_span(), txt_move_to(), txt_order_cursors(), and blender::gpu::wrap().
Referenced by text_find_and_replace(), and text_replace_all().
| void txt_from_buf_for_undo | ( | Text * | text, |
| const char * | buf, | ||
| int | buf_len | ||
| ) |
Decode a buffer from txt_to_buf_for_undo.
Definition at line 1410 of file text.c.
References BLI_addtail(), BLI_listbase_clear(), Text::curc, Text::curl, ListBase::first, TextLine::format, l, len, TextLine::line, Text::lines, MEM_freeN, MEM_mallocN, MEM_reallocN, MEM_SAFE_FREE, TextLine::next, NULL, Text::selc, Text::sell, and txt_make_dirty().
Referenced by text_state_decode().
Definition at line 716 of file text.c.
References from, TextLine::next, TextLine::prev, and ret.
Referenced by text_cursor_set_to_pos(), text_jump_exec(), text_selection_set_invoke(), text_state_encode(), txt_find_string(), txt_order_cursors(), txt_pop_first(), txt_pop_last(), and txt_sel_to_buf().
| bool txt_has_sel | ( | Text * | text | ) |
Definition at line 1242 of file text.c.
References Text::curc, Text::curl, Text::selc, and Text::sell.
Referenced by console_cursor_set_exit(), text_comment_exec(), text_cursor_set_exit(), text_delete_exec(), text_find_and_replace(), text_indent_exec(), text_indent_or_autocomplete_exec(), text_move_cursor(), text_replace_all(), text_state_encode(), txt_backspace_char(), txt_comment(), txt_copy_clipboard(), txt_delete_char(), txt_delete_sel(), and txt_replace_char().
| void txt_indent | ( | Text * | text | ) |
Definition at line 2267 of file text.c.
References Text::curl, ELEM, Text::flags, NULL, Text::sell, tab_to_spaces, txt_select_prefix(), and TXT_TABSTOSPACES.
Referenced by text_indent_exec().
| void txt_insert_buf | ( | Text * | text, |
| const char * | in_buffer | ||
| ) |
Definition at line 1647 of file text.c.
References add(), BLI_insertlinkbefore(), BLI_str_utf8_as_unicode_step(), BLI_strdupn(), buffer, Text::curl, l, len, Text::lines, MEM_freeN, txt_add_raw_char(), txt_delete_sel(), txt_extended_ascii_as_utf8(), txt_new_linen(), and txt_split_curline().
Referenced by BKE_text_write(), confirm_suggestion(), text_find_and_replace(), text_paste_exec(), text_replace_all(), and txt_convert_tab_to_spaces().
| void txt_jump_left | ( | Text * | text, |
| const bool | sel, | ||
| const bool | use_init_step | ||
| ) |
Definition at line 993 of file text.c.
References BLI_str_cursor_step_utf8(), STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, txt_curs_cur(), txt_curs_sel(), txt_pop_first(), and txt_pop_sel().
Referenced by text_move_cursor(), text_select_word_exec(), and txt_backspace_word().
| void txt_jump_right | ( | Text * | text, |
| const bool | sel, | ||
| const bool | use_init_step | ||
| ) |
Definition at line 1017 of file text.c.
References BLI_str_cursor_step_utf8(), STRCUR_DIR_NEXT, STRCUR_JUMP_DELIM, txt_curs_cur(), txt_curs_sel(), txt_pop_last(), and txt_pop_sel().
Referenced by text_move_cursor(), text_select_word_exec(), and txt_delete_word().
|
static |
Definition at line 756 of file text.c.
References BPY_text_free_code(), Text::compiled, Text::flags, and TXT_ISDIRTY.
Referenced by BKE_text_clear(), BKE_text_reload(), BKE_text_write(), txt_add_char_intern(), txt_backspace_char(), txt_backspace_word(), txt_combine_lines(), txt_delete_char(), txt_delete_line(), txt_delete_selected(), txt_delete_word(), txt_duplicate_line(), txt_from_buf_for_undo(), txt_move_lines(), txt_replace_char(), txt_select_prefix(), txt_select_unprefix(), and txt_split_curline().
| void txt_move_bof | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 1085 of file text.c.
References ListBase::first, Text::lines, txt_curs_cur(), txt_curs_sel(), and txt_pop_sel().
Referenced by text_move_cursor().
| void txt_move_bol | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 1041 of file text.c.
References txt_curs_cur(), txt_curs_sel(), and txt_pop_sel().
Referenced by text_move_cursor(), and txt_move_up().
| void txt_move_down | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 834 of file text.c.
References BLI_str_utf8_offset_from_column(), BLI_str_utf8_offset_to_column(), TextLine::next, txt_curs_cur(), txt_curs_sel(), txt_move_eol(), txt_pop_last(), and txt_pop_sel().
Referenced by text_move_cursor(), and txt_move_right().
| void txt_move_eof | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 1108 of file text.c.
References ListBase::last, Text::lines, txt_curs_cur(), txt_curs_sel(), and txt_pop_sel().
Referenced by BKE_text_write(), and text_move_cursor().
| void txt_move_eol | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 1063 of file text.c.
References txt_curs_cur(), txt_curs_sel(), and txt_pop_sel().
Referenced by text_move_cursor(), and txt_move_down().
| void txt_move_left | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 905 of file text.c.
References BLI_str_prev_char_utf8(), Text::flags, txt_calc_tab_left(), txt_curs_cur(), txt_curs_sel(), txt_move_up(), txt_pop_first(), txt_pop_sel(), and TXT_TABSTOSPACES.
Referenced by text_autocomplete_modal(), and text_move_cursor().
| void txt_move_lines | ( | struct Text * | text, |
| const int | direction | ||
| ) |
Definition at line 2289 of file text.c.
References BLI_assert, BLI_insertlinkafter(), BLI_insertlinkbefore(), BLI_remlink(), Text::curl, ELEM, if(), Text::lines, TextLine::next, TextLine::prev, Text::sell, txt_clean_text(), txt_make_dirty(), TXT_MOVE_LINE_DOWN, TXT_MOVE_LINE_UP, and txt_order_cursors().
Referenced by move_lines_exec().
| void txt_move_right | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 949 of file text.c.
References BLI_str_utf8_size(), Text::flags, txt_calc_tab_right(), txt_curs_cur(), txt_curs_sel(), txt_move_down(), txt_pop_last(), txt_pop_sel(), and TXT_TABSTOSPACES.
Referenced by text_autocomplete_modal(), and text_move_cursor().
| void txt_move_to | ( | Text * | text, |
| unsigned int | line, | ||
| unsigned int | ch, | ||
| const bool | sel | ||
| ) |
Definition at line 1137 of file text.c.
References ListBase::first, Text::lines, TextLine::next, txt_curs_cur(), txt_curs_sel(), and txt_pop_sel().
Referenced by python_script_error_jump_text(), text_reload_exec(), text_replace_all(), text_state_decode(), txt_find_string(), and txt_move_toline().
| void txt_move_toline | ( | Text * | text, |
| unsigned int | line, | ||
| const bool | sel | ||
| ) |
Definition at line 1131 of file text.c.
References txt_move_to().
Referenced by text_find_and_replace(), text_jump_exec(), text_line_number_invoke(), and text_replace_all().
| void txt_move_up | ( | Text * | text, |
| const bool | sel | ||
| ) |
Definition at line 804 of file text.c.
References BLI_str_utf8_offset_from_column(), BLI_str_utf8_offset_to_column(), TextLine::prev, txt_curs_cur(), txt_curs_sel(), txt_move_bol(), txt_pop_first(), and txt_pop_sel().
Referenced by text_move_cursor(), and txt_move_left().
|
static |
Definition at line 637 of file text.c.
References TextLine::format, TextLine::len, TextLine::line, MEM_mallocN, TextLine::next, NULL, TextLine::prev, and str.
Referenced by txt_clean_text(), and txt_duplicate_line().
|
static |
Definition at line 657 of file text.c.
References BLI_strncpy(), TextLine::format, TextLine::len, TextLine::line, MEM_mallocN, TextLine::next, NULL, TextLine::prev, and str.
Referenced by txt_insert_buf().
| void txt_order_cursors | ( | Text * | text, |
| const bool | reverse | ||
| ) |
Definition at line 1218 of file text.c.
References Text::curc, Text::curl, Text::selc, Text::sell, txt_curs_swap(), and txt_get_span().
Referenced by text_comment_exec(), text_delete_exec(), text_indent_exec(), text_move_cursor(), text_unindent_exec(), txt_delete_sel(), txt_find_string(), and txt_move_lines().
|
static |
Definition at line 1192 of file text.c.
References Text::curc, Text::curl, Text::selc, Text::sell, txt_curs_swap(), txt_get_span(), and txt_pop_sel().
Referenced by txt_jump_left(), txt_move_left(), and txt_move_up().
|
static |
Definition at line 1202 of file text.c.
References Text::curc, Text::curl, Text::selc, Text::sell, txt_curs_swap(), txt_get_span(), and txt_pop_sel().
Referenced by txt_jump_right(), txt_move_down(), and txt_move_right().
| void txt_pop_sel | ( | Text * | text | ) |
Definition at line 1212 of file text.c.
References Text::curc, Text::curl, Text::selc, and Text::sell.
Referenced by cursor_skip(), text_cursor_set_to_pos(), text_move_cursor(), txt_add_char_intern(), txt_backspace_char(), txt_delete_char(), txt_jump_left(), txt_jump_right(), txt_move_bof(), txt_move_bol(), txt_move_down(), txt_move_eof(), txt_move_eol(), txt_move_left(), txt_move_right(), txt_move_to(), txt_move_up(), txt_pop_first(), txt_pop_last(), txt_replace_char(), txt_split_curline(), txt_wrap_move_bol(), txt_wrap_move_down(), txt_wrap_move_eol(), and txt_wrap_move_up().
| bool txt_replace_char | ( | Text * | text, |
| unsigned int | add | ||
| ) |
Definition at line 2044 of file text.c.
References add(), BLI_str_utf8_as_unicode_and_size(), BLI_str_utf8_from_unicode(), BLI_UTF8_MAX, Text::curc, Text::curl, TextLine::len, TextLine::line, MEM_freeN, MEM_mallocN, txt_add_char(), txt_clean_text(), txt_has_sel(), txt_make_dirty(), txt_pop_sel(), and UNUSED_VARS.
Referenced by text_insert_exec().
| void txt_sel_all | ( | Text * | text | ) |
Definition at line 1287 of file text.c.
References Text::curc, Text::curl, ListBase::first, ListBase::last, TextLine::len, Text::lines, Text::selc, and Text::sell.
Referenced by BKE_text_clear(), and text_select_all_exec().
| void txt_sel_clear | ( | Text * | text | ) |
Reverse of txt_pop_sel Clears the selection and ensures the cursor is located at the selection (where the cursor is visually while editing).
Definition at line 1301 of file text.c.
References Text::curc, Text::curl, Text::selc, and Text::sell.
Referenced by text_move_cursor().
| void txt_sel_line | ( | Text * | text | ) |
Definition at line 1309 of file text.c.
References Text::curc, Text::curl, TextLine::len, Text::selc, and Text::sell.
Referenced by text_select_line_exec().
| void txt_sel_set | ( | Text * | text, |
| int | startl, | ||
| int | startc, | ||
| int | endl, | ||
| int | endc | ||
| ) |
Definition at line 1320 of file text.c.
References BLI_findlink(), BLI_listbase_count(), BLI_str_utf8_offset_from_index(), BLI_strlen_utf8(), CLAMP, CLAMP_MIN, Text::curc, Text::curl, ListBase::last, TextLine::line, Text::lines, NULL, Text::selc, and Text::sell.
| char* txt_sel_to_buf | ( | Text * | text, |
| int * | r_buf_strlen | ||
| ) |
Definition at line 1555 of file text.c.
References BLI_strncpy(), Text::curc, Text::curl, TextLine::len, length(), TextLine::line, MEM_mallocN, TextLine::next, NULL, Text::selc, Text::sell, and txt_get_span().
Referenced by console_cursor_set_exit(), text_cursor_set_exit(), text_find_and_replace(), text_find_set_selected_exec(), text_replace_set_selected_exec(), and txt_copy_clipboard().
|
static |
Generic prefix operation, use for comment & indent.
Definition at line 2094 of file text.c.
References add(), BLI_assert, Text::curc, Text::curl, ELEM, len, TextLine::len, TextLine::line, make_new_line(), MEM_mallocN, TextLine::next, NULL, TextLine::prev, Text::selc, Text::sell, txt_clean_text(), and txt_make_dirty().
Referenced by txt_comment(), and txt_indent().
|
static |
Generic un-prefix operation, use for comment & indent.
| require_all | When true, all non-empty lines must have this prefix. Needed for comments where we might want to un-comment a block which contains some comments. |
Definition at line 2173 of file text.c.
References BLI_assert, Text::curc, Text::curl, ELEM, l, TextLine::len, TextLine::line, MAX2, BMLoop::next, TextLine::next, NULL, TextLine::prev, Text::selc, Text::sell, STREQLEN, txt_clean_text(), and txt_make_dirty().
Referenced by txt_uncomment(), and txt_unindent().
| int txt_setcurr_tab_spaces | ( | Text * | text, |
| int | space | ||
| ) |
Definition at line 2320 of file text.c.
References Freestyle::a, Text::curc, Text::curl, ELEM, Text::flags, TextLine::line, NULL, and TXT_TABSTOSPACES.
Referenced by text_line_break_exec().
| void txt_split_curline | ( | Text * | text | ) |
Definition at line 1762 of file text.c.
References BLI_insertlinkbefore(), Text::curc, Text::curl, TextLine::format, left, TextLine::len, TextLine::line, Text::lines, MEM_freeN, MEM_mallocN, NULL, right, txt_clean_text(), txt_delete_sel(), txt_make_dirty(), and txt_pop_sel().
Referenced by text_line_break_exec(), txt_add_char_intern(), and txt_insert_buf().
| char* txt_to_buf | ( | Text * | text, |
| int * | r_buf_strlen | ||
| ) |
Definition at line 1478 of file text.c.
References BLI_strncpy(), Text::curl, ListBase::first, ListBase::last, TextLine::len, length(), TextLine::line, Text::lines, MEM_mallocN, TextLine::next, NULL, and Text::sell.
Referenced by python_script_exec().
| char* txt_to_buf_for_undo | ( | Text * | text, |
| int * | r_buf_len | ||
| ) |
Create a buffer, the only requirement is txt_from_buf_for_undo can decode it.
Definition at line 1390 of file text.c.
References l, Text::lines, LISTBASE_FOREACH, and MEM_mallocN.
Referenced by text_state_encode().
| bool txt_uncomment | ( | Text * | text | ) |
Definition at line 2256 of file text.c.
References Text::curl, ELEM, NULL, Text::sell, and txt_select_unprefix().
Referenced by text_comment_exec().
| bool txt_unindent | ( | Text * | text | ) |
Definition at line 2278 of file text.c.
References Text::curl, ELEM, Text::flags, NULL, Text::sell, tab_to_spaces, txt_select_unprefix(), and TXT_TABSTOSPACES.
Referenced by text_unindent_exec().
| IDTypeInfo IDType_ID_TXT |
|
static |
Definition at line 1973 of file text.c.
Referenced by txt_convert_tab_to_spaces(), txt_indent(), and txt_unindent().