Cleanup: Editors/Space/Text, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors/space_text` module. No functional changes.
This commit is contained in:
parent
2f6fc5a7e8
commit
bf532b1106
|
@ -256,7 +256,7 @@ static int text_context(const bContext *C, const char *member, bContextDataResul
|
|||
CTX_data_dir_set(result, text_context_dir);
|
||||
return 1;
|
||||
}
|
||||
else if (CTX_data_equals(member, "edit_text")) {
|
||||
if (CTX_data_equals(member, "edit_text")) {
|
||||
if (st->text != NULL) {
|
||||
CTX_data_id_pointer_set(result, &st->text->id);
|
||||
}
|
||||
|
|
|
@ -319,15 +319,12 @@ static int text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||
ED_undo_push(C, op->type->name);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
WM_event_add_modal_handler(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
text_autocomplete_free(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
WM_event_add_modal_handler(C, op);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
text_autocomplete_free(C, op);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int doc_scroll = 0;
|
||||
|
@ -590,10 +587,8 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
}
|
||||
return retval;
|
||||
}
|
||||
else {
|
||||
text_autocomplete_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
text_autocomplete_free(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void text_autocomplete_free(bContext *C, wmOperator *op)
|
||||
|
|
|
@ -234,11 +234,10 @@ void wrap_offset(
|
|||
if (i - lines < 0) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
linep = linep->next;
|
||||
(*offl) += lines - 1;
|
||||
i -= lines;
|
||||
}
|
||||
|
||||
linep = linep->next;
|
||||
(*offl) += lines - 1;
|
||||
i -= lines;
|
||||
}
|
||||
|
||||
max = wrap_width(st, region);
|
||||
|
@ -849,9 +848,7 @@ int text_get_span_wrap(const SpaceText *st, ARegion *region, TextLine *from, Tex
|
|||
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return txt_get_span(from, to);
|
||||
}
|
||||
return txt_get_span(from, to);
|
||||
}
|
||||
|
||||
int text_get_total_lines(SpaceText *st, ARegion *region)
|
||||
|
@ -1612,11 +1609,10 @@ void draw_text_main(SpaceText *st, ARegion *region)
|
|||
wrap_skip = st->top - wraplinecount;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
wraplinecount += lines;
|
||||
tmp = tmp->next;
|
||||
linecount++;
|
||||
}
|
||||
|
||||
wraplinecount += lines;
|
||||
tmp = tmp->next;
|
||||
linecount++;
|
||||
}
|
||||
else {
|
||||
tmp = tmp->next;
|
||||
|
|
|
@ -222,10 +222,9 @@ TextFormatType *ED_text_format_get(Text *text)
|
|||
* the "default" text format */
|
||||
return tft_lb.first;
|
||||
}
|
||||
else {
|
||||
/* Return the "default" text format */
|
||||
return tft_lb.first;
|
||||
}
|
||||
|
||||
/* Return the "default" text format */
|
||||
return tft_lb.first;
|
||||
}
|
||||
|
||||
bool ED_text_is_syntax_highlight_supported(Text *text)
|
||||
|
|
|
@ -226,7 +226,7 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
|
|||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
else if (cont) {
|
||||
if (cont) {
|
||||
/* Multi-line comments */
|
||||
if (cont & FMT_CONT_COMMENT_C) {
|
||||
if (*str == ']' && *(str + 1) == ']') {
|
||||
|
|
|
@ -252,7 +252,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_
|
|||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
else if (cont) {
|
||||
if (cont) {
|
||||
/* C-Style comments */
|
||||
if (cont & FMT_CONT_COMMENT_C) {
|
||||
if (*str == '*' && *(str + 1) == '/') {
|
||||
|
|
|
@ -825,7 +825,7 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
|
|||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
else if (cont) {
|
||||
if (cont) {
|
||||
/* C-Style comments */
|
||||
if (cont & FMT_CONT_COMMENT_C) {
|
||||
if (*str == '*' && *(str + 1) == '/') {
|
||||
|
|
|
@ -410,7 +410,7 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool
|
|||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
else if (cont) {
|
||||
if (cont) {
|
||||
/* Multi-line comments */
|
||||
if (cont & FMT_CONT_COMMENT_C) {
|
||||
if (*str == ']' && *(str + 1) == ']') {
|
||||
|
|
|
@ -376,7 +376,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
|
|||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
else if (cont) {
|
||||
if (cont) {
|
||||
/* Triple strings ("""...""" or '''...''') */
|
||||
if (cont & FMT_CONT_TRIPLE) {
|
||||
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
|
||||
|
|
|
@ -3012,7 +3012,7 @@ static void text_cursor_set_to_pos_wrapped(
|
|||
break;
|
||||
/* Exactly at the cursor */
|
||||
}
|
||||
else if (y == 0 && i - start <= x && i + columns - start > x) {
|
||||
if (y == 0 && i - start <= x && i + columns - start > x) {
|
||||
/* current position could be wrapped to next line */
|
||||
/* this should be checked when end of current line would be reached */
|
||||
charp = curs = j;
|
||||
|
@ -3471,21 +3471,20 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
else {
|
||||
char str[BLI_UTF8_MAX + 1];
|
||||
size_t len;
|
||||
|
||||
if (event->utf8_buf[0]) {
|
||||
len = BLI_str_utf8_size_safe(event->utf8_buf);
|
||||
memcpy(str, event->utf8_buf, len);
|
||||
}
|
||||
else {
|
||||
/* in theory, ghost can set value to extended ascii here */
|
||||
len = BLI_str_utf8_from_unicode(event->ascii, str);
|
||||
}
|
||||
str[len] = '\0';
|
||||
RNA_string_set(op->ptr, "text", str);
|
||||
char str[BLI_UTF8_MAX + 1];
|
||||
size_t len;
|
||||
|
||||
if (event->utf8_buf[0]) {
|
||||
len = BLI_str_utf8_size_safe(event->utf8_buf);
|
||||
memcpy(str, event->utf8_buf, len);
|
||||
}
|
||||
else {
|
||||
/* in theory, ghost can set value to extended ascii here */
|
||||
len = BLI_str_utf8_from_unicode(event->ascii, str);
|
||||
}
|
||||
str[len] = '\0';
|
||||
RNA_string_set(op->ptr, "text", str);
|
||||
}
|
||||
|
||||
ret = text_insert_exec(C, op);
|
||||
|
@ -3673,9 +3672,7 @@ static int text_replace_exec(bContext *C, wmOperator *op)
|
|||
if (replace_all) {
|
||||
return text_replace_all(C);
|
||||
}
|
||||
else {
|
||||
return text_find_and_replace(C, op, TEXT_REPLACE);
|
||||
}
|
||||
return text_find_and_replace(C, op, TEXT_REPLACE);
|
||||
}
|
||||
|
||||
void TEXT_OT_replace(wmOperatorType *ot)
|
||||
|
|
Loading…
Reference in New Issue