From aba4e6810f8b4d0e459137b64e061a2cadc457d1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 31 May 2019 23:21:16 +1000 Subject: Cleanup: style, use braces in source/ (include disabled blocks) --- source/blender/editors/space_text/text_draw.c | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'source/blender/editors/space_text/text_draw.c') diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index ac1fb4af1c2..c03b804aa2c 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -107,11 +107,13 @@ static void txt_format_text(SpaceText *st) { TextLine *linep; - if (!st->text) + if (!st->text) { return; + } - for (linep = st->text->lines.first; linep; linep = linep->next) + for (linep = st->text->lines.first; linep; linep = linep->next) { txt_format_line(st, linep, 0); + } } #endif @@ -1024,23 +1026,29 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) int i, br, lines; int boxw, boxh, l, x, y /* , top */ /* UNUSED */; - if (!st || !st->text) + if (!st || !st->text) { return; - if (!texttool_text_is_active(st->text)) + } + if (!texttool_text_is_active(st->text)) { return; + } docs = texttool_docs_get(); - if (!docs) + if (!docs) { return; + } text_draw_context_init(st, &tdc); /* Count the visible lines to the cursor */ - for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) - ; - if (l < 0) + for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) { + /* pass */ + } + + if (l < 0) { return; + } if (st->showlinenrs) { x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4; @@ -1089,10 +1097,12 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) br = DOC_WIDTH; lines = 0; // XXX -doc_scroll; for (p = docs; *p; p++) { - if (*p == '\r' && *(++p) != '\n') + if (*p == '\r' && *(++p) != '\n') { *(--p) = '\n'; /* Fix line endings */ - if (*p == ' ' || *p == '\t') + } + if (*p == ' ' || *p == '\t') { br = i; + } else if (*p == '\n') { buf[i] = '\0'; if (lines >= 0) { @@ -1115,8 +1125,9 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) br = DOC_WIDTH; lines++; } - if (lines >= DOC_HEIGHT) + if (lines >= DOC_HEIGHT) { break; + } } } #endif -- cgit v1.2.3