#499 Multiple caret editing


jEdit has multiple selection, but doesn't have multiple caret editing, e.g., https://www.youtube.com/watch?v=xnKN0T_UBgU. Is it possible to add that feature? Thanks.


  • Skeeve

    Skeeve - 2017-10-28

    Does this macro help a bit?

    if (! textArea.isMultipleSelectionEnabled() ) {
    textArea.userInput(' ');
    textArea.setSelection(new Selection.Range( textArea.getCaretPosition()-1, textArea.getCaretPosition() ) );

    How to use it:
    1. Position the cursor where you want your first caret
    2. Execute the macro -> A space will be inserted and selected
    3. If you want more carets, Place your cursor where you want your next caret and repeat from 2
    4. Otherwiise start typing

    This doesn't give you automatic End-Of-Line multiple-carets, but at least you have something.

  • Skeeve

    Skeeve - 2017-10-29

    And here is a macro which will select all your end-of-lines for the current selection(s)

    sl= textArea.getSelectedLines();
    for (var i=sl.length; i-->0; ) {
        textArea.userInput(' ');
    if (! textArea.isMultipleSelectionEnabled() ) {
    for (var i=sl.length; i-->0; ) {
        s= textArea.getLineEndOffset(sl[i]);
        textArea.addToSelection(new Selection.Range(s-2,s-1));

    So now you have something like the "multi-Caret-Editing".

    Proposal: Close Ticket.

  • ahlearn

    ahlearn - 2017-10-30

    But MultipleSelection cannot edit / delete text outside of the selection..

  • Skeeve

    Skeeve - 2017-10-30

    You didn't try, did you?

    Sorry! I think i understood what you meant: If I place the cursors (selections) at the end of the lines, I can only insert new characters and not even delete them. Also I cannot delete to the left.

    Last edit: Skeeve 2017-10-30
  • Skeeve

    Skeeve - 2017-10-30
    • Alan Ezust

      Alan Ezust - 2017-10-30

      Wow, that's pretty cool! Perhaps we should add those macros to jEdit, although perhaps it needs some work still?

      Last edit: Alan Ezust 2017-10-30
      • Skeeve

        Skeeve - 2017-10-31

        Feel free to add them. I do not see how I could enhance them. I'm not doing anything fancy.

        The first macro simply inserts a space and selects it while keeping all the other selections.

        The second one just inserts a space at the end of every selected line, dops the previous selection and selects all those spaces.

        The only improvement I could think of lies within jEdit: You could allow to delete to the left of selections.

        You see: In the movie, before I inserted th li-tags I pressed backspace to delete the numbers to the left of the selections. It didn't work.

        Would I have used a rectangular, non-empty selection left of the numbers, I could have deleted them with backspace.

        If you can make such deletions possible in jEdit, I think we have all we'd require for "multi-caret editing".

        But I don't think I'm capable of changing jEdit accordingly.

        P.S.: I think I broke sourceforge a bit by using less-than li greater-than ;) I deleted the post, but parts still show up here. Sorry :(


Log in to post a comment.