Action

Up

Posted by mat, Last update 6 months ago

move up

Steps

  • script

    // cursor up
    
    var ending = '\n';
    
    var selRange = editor.getSelectedRange();
    var cursor = selRange[0];
    var t = editor.getText();
    
    var endPrevLine = t.lastIndexOf(ending, cursor-1);
    var begLine = endPrevLine+1;
    
    var endPrevPrevLine = t.lastIndexOf(ending, endPrevLine-1);
    var begPrevLine = endPrevPrevLine+1;
    var lenPrevLine = endPrevLine-begPrevLine;
    
    var column = Math.min(lenPrevLine, cursor-begLine);
    cursor = Math.max(0, begPrevLine+column);
    editor.setSelectedRange(cursor, 0);
    

Options

  • After Success Nothing
    Notification Error
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.