Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index c1f2c66badb..6f4ac4c44a0 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -243,7 +243,7 @@ IDTypeInfo IDType_ID_TXT = {
.name = "Text",
.name_plural = "texts",
.translation_context = BLT_I18NCONTEXT_ID_TEXT,
- .flags = 0,
+ .flags = IDTYPE_FLAGS_NO_ANIMDATA,
.init_data = text_init_data,
.copy_data = text_copy_data,
@@ -256,6 +256,8 @@ IDTypeInfo IDType_ID_TXT = {
.blend_read_data = text_blend_read_data,
.blend_read_lib = NULL,
.blend_read_expand = NULL,
+
+ .blend_read_undo_preserve = NULL,
};
/** \} */
@@ -287,12 +289,10 @@ Text *BKE_text_add(Main *bmain, const char *name)
{
Text *ta;
- ta = BKE_libblock_alloc(bmain, ID_TXT, name, 0);
+ ta = BKE_id_new(bmain, ID_TXT, name);
/* Texts always have 'real' user (see also read code). */
id_us_ensure_real(&ta->id);
- text_init_data(&ta->id);
-
return ta;
}
@@ -397,7 +397,7 @@ static void text_from_buf(Text *text, const unsigned char *buffer, const int len
* in this case content of such line would be used to fill text line buffer
* - file is empty. in this case new line is needed to start editing from.
* - last character in buffer is \n. in this case new line is needed to
- * deal with newline at end of file. (see [#28087]) (sergey) */
+ * deal with newline at end of file. (see T28087) (sergey) */
if (llen != 0 || lines_count == 0 || buffer[len - 1] == '\n') {
TextLine *tmp;
@@ -516,13 +516,6 @@ Text *BKE_text_load(Main *bmain, const char *file, const char *relpath)
return BKE_text_load_ex(bmain, file, relpath, false);
}
-Text *BKE_text_copy(Main *bmain, const Text *ta)
-{
- Text *ta_copy;
- BKE_id_copy(bmain, &ta->id, (ID **)&ta_copy);
- return ta_copy;
-}
-
void BKE_text_clear(Text *text) /* called directly from rna */
{
txt_sel_all(text);
@@ -915,7 +908,7 @@ void txt_move_left(Text *text, const bool sel)
}
else {
/* do nice left only if there are only spaces */
- // TXT_TABSIZE hardcoded in DNA_text_types.h
+ /* #TXT_TABSIZE hard-coded in DNA_text_types.h */
if (text->flags & TXT_TABSTOSPACES) {
tabsize = txt_calc_tab_left(*linep, *charp);
}
@@ -2330,7 +2323,7 @@ int txt_setcurr_tab_spaces(Text *text, int space)
/* if we find a ':' on this line, then add a tab but not if it is:
* 1) in a comment
* 2) within an identifier
- * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
+ * 3) after the cursor (text->curc), i.e. when creating space before a function def T25414.
*/
int a;
bool is_indent = false;
@@ -2342,7 +2335,7 @@ int txt_setcurr_tab_spaces(Text *text, int space)
if (ch == ':') {
is_indent = 1;
}
- else if (ch != ' ' && ch != '\t') {
+ else if (!ELEM(ch, ' ', '\t')) {
is_indent = 0;
}
}
@@ -2468,7 +2461,7 @@ int text_check_identifier_nodigit_unicode(const unsigned int ch)
bool text_check_whitespace(const char ch)
{
- if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') {
+ if (ELEM(ch, ' ', '\t', '\r', '\n')) {
return true;
}
return false;