forked from bartvdbraak/blender
by Ignacio Fernández (hellmoon666)
This commit is contained in:
parent
ba627ff40c
commit
94c35e2012
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user