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>2010-03-31 12:33:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-03-31 12:33:43 +0400
commit94c35e201223895d6024cc202d02661faf250c93 (patch)
tree45ebac771966f2a1fbbe73862e0c7eb4608e3595 /source/blender/editors
parentba627ff40c77c955a203449455494ff0549d5ffa (diff)
[#21851] Bugfix: [#21254] text editor jump to line crash
by Ignacio Fernández (hellmoon666)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_text/text_ops.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index ce7db83d6d8..8cb2b4be628 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1595,10 +1595,12 @@ static int jump_exec(bContext *C, wmOperator *op)
int line= RNA_int_get(op->ptr, "line");
short nlines= txt_get_span(text->lines.first, text->lines.last)+1;
- if(line < 1 || line > nlines)
- return OPERATOR_CANCELLED;
-
- txt_move_toline(text, line-1, 0);
+ if(line < 1)
+ txt_move_toline(text, 1, 0);
+ else if(line > nlines)
+ txt_move_toline(text, nlines-1, 0);
+ else
+ txt_move_toline(text, line-1, 0);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
@@ -1606,6 +1608,12 @@ static int jump_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+static int jump_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ return WM_operator_props_dialog_popup(C,op,200,100);
+
+}
+
void TEXT_OT_jump(wmOperatorType *ot)
{
/* identifiers */
@@ -1614,7 +1622,7 @@ void TEXT_OT_jump(wmOperatorType *ot)
ot->description= "Jump cursor to line";
/* api callbacks */
- ot->invoke= WM_operator_props_popup;
+ ot->invoke= jump_invoke;
ot->exec= jump_exec;
ot->poll= text_edit_poll;