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_console/console_ops.c')
-rw-r--r--source/blender/editors/space_console/console_ops.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index d3ae5373a18..bb46135545c 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -157,10 +157,9 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
if (from) {
- ci->line = BLI_strdup(from->line);
- ci->len = strlen(ci->line);
- ci->len_alloc = ci->len;
-
+ BLI_assert(strlen(from->line) == from->len);
+ ci->line = BLI_strdupn(from->line, from->len);
+ ci->len = ci->len_alloc = from->len;
ci->cursor = from->cursor;
ci->type = from->type;
}
@@ -174,10 +173,8 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
return ci;
}
-static ConsoleLine *console_history_add(const bContext *C, ConsoleLine *from)
+static ConsoleLine *console_history_add(SpaceConsole *sc, ConsoleLine *from)
{
- SpaceConsole *sc = CTX_wm_space_console(C);
-
return console_lb_add__internal(&sc->history, from);
}
@@ -217,7 +214,7 @@ ConsoleLine *console_history_verify(const bContext *C)
SpaceConsole *sc = CTX_wm_space_console(C);
ConsoleLine *ci = sc->history.last;
if (ci == NULL)
- ci = console_history_add(C, NULL);
+ ci = console_history_add(sc, NULL);
return ci;
}
@@ -623,8 +620,9 @@ static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- console_history_add(C, ci);
- console_history_add(C, NULL);
+ console_history_add(sc, ci);
+ console_history_add(sc, NULL);
+ console_select_offset(sc, -ci->len);
console_textview_update_rect(sc, ar);
@@ -727,7 +725,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
while ((cl = console_history_find(sc, ci->line, ci)))
console_history_free(sc, cl);
- console_history_add(C, (ConsoleLine *)sc->history.last);
+ console_history_add(sc, (ConsoleLine *)sc->history.last);
}
ci = sc->history.last;