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:
authorCampbell Barton <ideasman42@gmail.com>2012-05-09 18:58:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-09 18:58:57 +0400
commit895e426e2661b4969a9aaa6d1c526253e2e9e1d4 (patch)
treef10261115535ed746a9373e59faf1b026fe4ae0a /source/blender/editors/space_console/console_ops.c
parente6a022816cd013b9d0399c4dc3beb522e144ac64 (diff)
patch [#31359] Py Console: Empty current line
from Sebastian Nell (codemanx), with some edits - Changed key shortcut to Shift+Enter. - made into its own operator since it works differently to delete.
Diffstat (limited to 'source/blender/editors/space_console/console_ops.c')
-rw-r--r--source/blender/editors/space_console/console_ops.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index ef036b071be..5d63a223c08 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -519,6 +519,39 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
}
+static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ SpaceConsole *sc = CTX_wm_space_console(C);
+ ARegion *ar = CTX_wm_region(C);
+ ConsoleLine *ci = console_history_verify(C);
+
+ if (ci->len == 0) {
+ return OPERATOR_CANCELLED;
+ }
+
+ console_history_add(C, ci);
+ console_history_add(C, NULL);
+
+ console_textview_update_rect(sc, ar);
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ console_scroll_bottom(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+void CONSOLE_OT_clear_line(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Clear Line";
+ ot->description = "Clear the line and store in history";
+ ot->idname = "CONSOLE_OT_clear_line";
+
+ /* api callbacks */
+ ot->exec = console_clear_line_exec;
+ ot->poll = ED_operator_console_active;
+}
/* the python exec operator uses this */
static int console_clear_exec(bContext *C, wmOperator *op)
@@ -571,7 +604,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
- ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevernts crashes when no command line */
+ ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */
short reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
int prev_len = ci->len;
@@ -584,7 +617,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
console_history_free(sc, ci_prev);
}
- if (reverse) { /* last item in mistory */
+ if (reverse) { /* last item in history */
ci = sc->history.last;
BLI_remlink(&sc->history, ci);
BLI_addhead(&sc->history, ci);