diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-15 06:11:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-15 06:11:40 +0400 |
commit | 283ee53085b1e215cbd0d8af91b0000660406bfe (patch) | |
tree | 498c2640d15304d71268157af098f3f146f077b0 /source | |
parent | cd8584aad56eb7fcc94dc4ebfbcde034aebbe3cd (diff) |
fix for deleting lines hanging the text editor when no markers are used, presence of markers still hangs.
also compiler warnings and some style edits.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 35 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_bevel.c | 3 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MapRangeOperation.cpp | 8 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 29 |
4 files changed, 41 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 076dc3a35d7..d166592424d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1764,7 +1764,7 @@ void txt_undo_add_op(Text *text, int op) txt_undo_store_cursors(text); text->undo_buf[text->undo_pos] = op; - text->undo_buf[text->undo_pos+1] = 0; + text->undo_buf[text->undo_pos + 1] = 0; } /* store an operator for a single character */ @@ -2386,20 +2386,22 @@ void txt_split_curline(Text *text) static void txt_delete_line(Text *text, TextLine *line) { TextMarker *mrk = NULL, *nxt; - int lineno = -1; if (!text) return; if (!text->curl) return; - lineno = txt_get_span(text->lines.first, line); - mrk = text->markers.first; - while (mrk) { - nxt = mrk->next; - if (mrk->lineno == lineno) - BLI_freelinkN(&text->markers, mrk); - else if (mrk->lineno > lineno) - mrk->lineno--; - mrk = nxt; + /* warning, this can be _slow_ when deleting many lines! */ + if ((mrk = text->markers.first)) { + int lineno = txt_get_span(text->lines.first, line); + mrk = text->markers.first; + while (mrk) { + nxt = mrk->next; + if (mrk->lineno == lineno) + BLI_freelinkN(&text->markers, mrk); + else if (mrk->lineno > lineno) + mrk->lineno--; + mrk = nxt; + } } BLI_remlink(&text->lines, line); @@ -2417,14 +2419,14 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) { char *tmp; TextMarker *mrk = NULL; - int lineno = -1; - + if (!text) return; if (!linea || !lineb) return; mrk = txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0); if (mrk) { + int lineno; lineno = mrk->lineno; do { mrk->lineno--; @@ -2433,8 +2435,11 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) mrk = mrk->next; } while (mrk && mrk->lineno == lineno); } - if (lineno == -1) lineno = txt_get_span(text->lines.first, lineb); - +#if 0 /* UNUSED */ + if (lineno == -1) + lineno = txt_get_span(text->lines.first, lineb); +#endif + tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string"); strcpy(tmp, linea->line); diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index 281ff44e358..2209c60b280 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -110,7 +110,8 @@ typedef struct BevelParams { float offset; /* blender units to offset each side of a beveled edge */ int seg; /* number of segments in beveled edge profile */ } BevelParams; -#include "bevdebug.c" + +//#include "bevdebug.c" /* Make a new BoundVert of the given kind, insert it at the end of the circular linked * list with entry point bv->boundstart, and return it. */ diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp index c25b056130b..a18f418e48e 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp @@ -51,10 +51,10 @@ void MapRangeOperation::executePixel(float output[4], float x, float y, PixelSam float dest_min, dest_max; this->m_inputOperation->read(inputs, x, y, sampler); - this->m_sourceMinOperation->read(inputs+1, x, y, sampler); - this->m_sourceMaxOperation->read(inputs+2, x, y, sampler); - this->m_destMinOperation->read(inputs+3, x, y, sampler); - this->m_destMaxOperation->read(inputs+4, x, y, sampler); + this->m_sourceMinOperation->read(inputs + 1, x, y, sampler); + this->m_sourceMaxOperation->read(inputs + 2, x, y, sampler); + this->m_destMinOperation->read(inputs + 3, x, y, sampler); + this->m_destMaxOperation->read(inputs + 4, x, y, sampler); value = inputs[0]; source_min = inputs[1]; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 53e731bf2c4..105e20ffadb 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1135,7 +1135,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op) tmp = text->lines.first; - //first convert to all space, this make it a lot easier to convert to tabs because there is no mixtures of ' ' && '\t' + /* first convert to all space, this make it a lot easier to convert to tabs + * because there is no mixtures of ' ' && '\t' */ while (tmp) { text_check_line = tmp->line; number = flatten_string(st, &fs, text_check_line) + 1; @@ -1669,8 +1670,8 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) text_update_character_width(st); - if (sel) linep = &text->sell, charp = &text->selc; - else linep = &text->curl, charp = &text->curc; + if (sel) { linep = &text->sell; charp = &text->selc; } + else { linep = &text->curl; charp = &text->curc; } oldc = *charp; @@ -1735,8 +1736,8 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel) text_update_character_width(st); - if (sel) linep = &text->sell, charp = &text->selc; - else linep = &text->curl, charp = &text->curc; + if (sel) { linep = &text->sell; charp = &text->selc; } + else { linep = &text->curl; charp = &text->curc; } oldc = *charp; @@ -1798,8 +1799,8 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel) text_update_character_width(st); - if (sel) linep = &text->sell, charp = &text->selc; - else linep = &text->curl, charp = &text->curc; + if (sel) { linep = &text->sell; charp = &text->selc; } + else { linep = &text->curl; charp = &text->curc; } wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); col = text_get_char_pos(st, (*linep)->line, *charp) + offc; @@ -1825,12 +1826,12 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel) Text *text = st->text; TextLine **linep; int *charp; - int offl, offc, col, newl, visible_lines; + int offl, offc, col, visible_lines; text_update_character_width(st); - if (sel) linep = &text->sell, charp = &text->selc; - else linep = &text->curl, charp = &text->curc; + if (sel) { linep = &text->sell; charp = &text->selc; } + else { linep = &text->curl; charp = &text->curc; } wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); col = text_get_char_pos(st, (*linep)->line, *charp) + offc; @@ -1860,8 +1861,8 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, int s TextLine **linep; int *charp; - if (sel) linep = &text->sell, charp = &text->selc; - else linep = &text->curl, charp = &text->curc; + if (sel) { linep = &text->sell; charp = &text->selc; } + else { linep = &text->curl; charp = &text->curc; } if (st && ar && st->wordwrap) { int rell, relc; @@ -2590,7 +2591,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in if (linep && charp != -1) { if (sel) { text->sell = linep; text->selc = charp; } - else { text->curl = linep; text->curc = charp; } + else { text->curl = linep; text->curc = charp; } } } @@ -2615,7 +2616,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int int w; if (sel) { linep = &text->sell; charp = &text->selc; } - else { linep = &text->curl; charp = &text->curc; } + else { linep = &text->curl; charp = &text->curc; } y -= txt_get_span(text->lines.first, *linep) - st->top; |