diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-15 15:24:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-15 15:30:31 +0300 |
commit | b8e8c0e325d213f2dcf4adad5506989fa224716e (patch) | |
tree | adb3d7fa8735426ea856a929f562655b2eaf64cb /source/blender/editors/space_text | |
parent | 4226ee0b71fec6f08897dacf3d6632526618acca (diff) |
Cleanup: comment line length (editors)
Prevents clang-format wrapping text before comments.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/text_autocomplete.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 25 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_format.h | 30 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 12 |
4 files changed, 47 insertions, 23 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 4f6a3bc82ba..f3433352d54 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -194,7 +194,8 @@ static GHash *text_autocomplete_build(Text *text) str_sub[choice_len] = '\0'; if (!BLI_ghash_lookup(gh, str_sub)) { char *str_dup = BLI_strdupn(str_sub, choice_len); - BLI_ghash_insert(gh, str_dup, str_dup); /* A 'set' would make more sense here */ + /* A 'set' would make more sense here */ + BLI_ghash_insert(gh, str_dup, str_dup); } str_sub[choice_len] = str_sub_last; } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 765bfbd9b83..fd7d2c92db9 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -562,13 +562,21 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar) nlines = drawcache->nlines; /* check if full cache update is needed */ - full_update |= drawcache->winx != ar->winx; /* area was resized */ - full_update |= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */ - full_update |= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */ - full_update |= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */ - full_update |= drawcache->lheight != st->lheight_dpi; /* word-wrapping option was toggled */ - full_update |= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */ - full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */ + + /* area was resized */ + full_update |= drawcache->winx != ar->winx; + /* word-wrapping option was toggled */ + full_update |= drawcache->wordwrap != st->wordwrap; + /* word-wrapping option was toggled */ + full_update |= drawcache->showlinenrs != st->showlinenrs; + /* word-wrapping option was toggled */ + full_update |= drawcache->tabnumber != st->tabnumber; + /* word-wrapping option was toggled */ + full_update |= drawcache->lheight != st->lheight_dpi; + /* word-wrapping option was toggled */ + full_update |= drawcache->cwidth != st->cwidth; + /* text datablock was changed */ + full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME); if (st->wordwrap) { /* update line heights */ @@ -815,7 +823,8 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back) scroll->ymin = pix_top_margin; scroll->ymax = pix_available; - /* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */ + /* when re-sizing a view-port with the bar at the bottom to a greater height + * more blank lines will be added */ if (ltexth + blank_lines < st->top + st->viewlines) { blank_lines = st->top + st->viewlines - ltexth; } diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h index 5912dc2402c..0259f24e487 100644 --- a/source/blender/editors/space_text/text_format.h +++ b/source/blender/editors/space_text/text_format.h @@ -83,16 +83,26 @@ typedef struct TextFormatType { } TextFormatType; enum { - FMT_TYPE_WHITESPACE = '_', /* Whitespace */ - FMT_TYPE_COMMENT = '#', /* Comment text */ - FMT_TYPE_SYMBOL = '!', /* Punctuation and other symbols */ - FMT_TYPE_NUMERAL = 'n', /* Numerals */ - FMT_TYPE_STRING = 'l', /* String letters */ - FMT_TYPE_DIRECTIVE = 'd', /* Decorator / Preprocessor directive */ - FMT_TYPE_SPECIAL = 'v', /* Special variables (class, def) */ - FMT_TYPE_RESERVED = 'r', /* Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */ - FMT_TYPE_KEYWORD = 'b', /* Built-in names (return, for, etc.) */ - FMT_TYPE_DEFAULT = 'q', /* Regular text (identifiers, etc.) */ + /** Whitespace */ + FMT_TYPE_WHITESPACE = '_', + /** Comment text */ + FMT_TYPE_COMMENT = '#', + /** Punctuation and other symbols */ + FMT_TYPE_SYMBOL = '!', + /** Numerals */ + FMT_TYPE_NUMERAL = 'n', + /** String letters */ + FMT_TYPE_STRING = 'l', + /** Decorator / Preprocessor directive */ + FMT_TYPE_DIRECTIVE = 'd', + /** Special variables (class, def) */ + FMT_TYPE_SPECIAL = 'v', + /** Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */ + FMT_TYPE_RESERVED = 'r', + /** Built-in names (return, for, etc.) */ + FMT_TYPE_KEYWORD = 'b', + /** Regular text (identifiers, etc.) */ + FMT_TYPE_DEFAULT = 'q', }; TextFormatType *ED_text_format_get(Text *text); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index fe6c43cb74a..0045eec4f7e 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1188,7 +1188,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op) if (tmp->format) MEM_freeN(tmp->format); - /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */ + /* Put new_line in the tmp->line spot + * still need to try and set the curc correctly. */ tmp->line = BLI_strdup(tmp_line); tmp->len = strlen(tmp_line); tmp->format = NULL; @@ -2144,7 +2145,8 @@ typedef struct TextScroll { static bool text_scroll_poll(bContext *C) { - /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */ + /* it should be possible to still scroll linked texts to read them, + * even if they can't be edited... */ return CTX_data_edit_text(C) != NULL; } @@ -2470,7 +2472,8 @@ static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y) lines = text_get_visible_lines(st, ar, linep->line); if (i + lines > *y) { - /* We found the line matching given vertical 'coordinate', now set y relative to this line's start. */ + /* We found the line matching given vertical 'coordinate', + * now set y relative to this line's start. */ *y -= i; break; } @@ -2530,7 +2533,8 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in end = MIN2(end, i); if (found) { - /* exact cursor position was found, check if it's still on needed line (hasn't been wrapped) */ + /* exact cursor position was found, check if it's still on needed line + * (hasn't been wrapped) */ if (charp > endj && !chop && ch != '\0') charp = endj; break; |