From 94c35e201223895d6024cc202d02661faf250c93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 31 Mar 2010 08:33:43 +0000 Subject: =?UTF-8?q?[#21851]=20Bugfix:=20[#21254]=20text=20editor=20jump=20?= =?UTF-8?q?to=20line=20crash=20=20by=20Ignacio=20Fern=C3=A1ndez=20(hellmoo?= =?UTF-8?q?n666)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/editors/space_text/text_ops.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_text') 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; -- cgit v1.2.3