Fix: Text editor, blank lines were being indented
Summary: fixes T37613 Reviewers: campbellbarton, sergey Reviewed By: sergey Maniphest Tasks: T37613 Differential Revision: http://developer.blender.org/D42
This commit is contained in:
@@ -2650,22 +2650,26 @@ void txt_indent(Text *text)
|
|||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
tmp = MEM_mallocN(text->curl->len + indentlen + 1, "textline_string");
|
|
||||||
|
|
||||||
text->curc = 0;
|
|
||||||
if (text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
|
|
||||||
memcpy(tmp + text->curc, add, indentlen);
|
|
||||||
|
|
||||||
len = text->curl->len - text->curc;
|
|
||||||
if (len > 0) memcpy(tmp + text->curc + indentlen, text->curl->line + text->curc, len);
|
|
||||||
tmp[text->curl->len + indentlen] = 0;
|
|
||||||
|
|
||||||
make_new_line(text->curl, tmp);
|
/* don't indent blank lines */
|
||||||
|
if (text->curl->len != 0) {
|
||||||
text->curc += indentlen;
|
tmp = MEM_mallocN(text->curl->len + indentlen + 1, "textline_string");
|
||||||
|
|
||||||
txt_make_dirty(text);
|
text->curc = 0;
|
||||||
txt_clean_text(text);
|
if (text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
|
||||||
|
memcpy(tmp + text->curc, add, indentlen);
|
||||||
|
|
||||||
|
len = text->curl->len - text->curc;
|
||||||
|
if (len > 0) memcpy(tmp + text->curc + indentlen, text->curl->line + text->curc, len);
|
||||||
|
tmp[text->curl->len + indentlen] = 0;
|
||||||
|
|
||||||
|
make_new_line(text->curl, tmp);
|
||||||
|
|
||||||
|
text->curc += indentlen;
|
||||||
|
|
||||||
|
txt_make_dirty(text);
|
||||||
|
txt_clean_text(text);
|
||||||
|
}
|
||||||
|
|
||||||
if (text->curl == text->sell) {
|
if (text->curl == text->sell) {
|
||||||
text->selc += indentlen;
|
text->selc += indentlen;
|
||||||
|
|||||||
Reference in New Issue
Block a user