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.
This commit is contained in:
parent
cd8584aad5
commit
283ee53085
@ -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,12 +2386,13 @@ 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);
|
||||
/* 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;
|
||||
@ -2401,6 +2402,7 @@ static void txt_delete_line(Text *text, TextLine *line)
|
||||
mrk->lineno--;
|
||||
mrk = nxt;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_remlink(&text->lines, line);
|
||||
|
||||
@ -2417,7 +2419,6 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
|
||||
{
|
||||
char *tmp;
|
||||
TextMarker *mrk = NULL;
|
||||
int lineno = -1;
|
||||
|
||||
if (!text) return;
|
||||
|
||||
@ -2425,6 +2426,7 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
|
||||
|
||||
mrk = txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
|
||||
if (mrk) {
|
||||
int lineno;
|
||||
lineno = mrk->lineno;
|
||||
do {
|
||||
mrk->lineno--;
|
||||
@ -2433,7 +2435,10 @@ 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");
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user