Action

Duplicate Line

Posted by agiletortoise, Last update over 4 years ago

Duplicate the current line, inserting it below.

Steps

  • script

    // get range and text of current line
    let [origSt, origLen] = editor.getSelectedRange();
    let [st, len] = editor.getSelectedLineRange();
    let lnText = editor.getTextInRange(st, len);
    
    // insert new line
    editor.setTextInRange(st+len, 0, lnText);
    
    // restore selection
    editor.activate();
    editor.setSelectedRange(origSt, origLen);

Options

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