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/editors/space_text/text_draw.c')
-rw-r--r--source/blender/editors/space_text/text_draw.c33
1 files changed, 22 insertions, 11 deletions
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