#1489 SCI_DELWORDLEFT should operate on multiple carets

scintilla (297)

When I have mulitiple carets, pressing backspace deletes the character to
the left of each caret. Pressing Ctrl-backspace, which is mapped to
SCI_DELWORDLEFT, deletes the word to the left of only the first caret. I'd
prefer if it worked like a simple delete.

Currently I'm ending multi-caret sessions on any non-insertion key event
except those that are mapped to backspace, paste, and delete-word-left.
I'm tempted to also end them if a backspace would move to the left of the
initial starting position, otherwise you can easily rip a document to shreds,
but then I would be second-guessing our users.

In other words, I'm still sitting on the fence between being draconian and
being open-ended during multi-caret sessions. But delete-word-left makes sense.


  • Neil Hodgson

    Neil Hodgson - 2013-06-20
    • labels: --> scintilla
    • assigned_to: Neil Hodgson
    • Group: Bug --> Feature_Request
  • Neil Hodgson

    Neil Hodgson - 2013-06-20

    Expanding multiple selection operations is reasonable but may not suit everyone so should be selectable with more settings. Multiple selection SCI_DELWORDLEFT should, like Backspace, stop at line start.

    If SCI_DELWORDLEFT is added then expectations of symmetry probably mean adding SCI_DELWORDRIGHT. SCI_DELLINELEFT/SCI_DELLINERIGHT may also be useful. Then there are selection extension methods: when SCI_DELETEBACK is applicable, SCI_CHARLEFTEXTEND could also be worthwhile.

  • Eric Promislow

    Eric Promislow - 2013-06-20

    I don't see the symmetry here. I've configured Komodo's multi-caret sessions so if you backspace to a starting point, you end the session, and the backspace applies only to the first caret in the list (otherwise things can get quite weird). Similarly, if you have a set of carets and invoke Clear, the session ends and the command applies only to the first caret. Maybe I'm being too draconian, but if you allow open-ended deletion with multiple carets, eventually carets can merge together. But like I said in the OP, maybe I'm being too draconian, and should just allow any operation in multiple-carets.

  • Neil Hodgson

    Neil Hodgson - 2013-06-27

    Some applications, including Visual Studio, allow Ctrl+{Backspace|Delete} for rectangular selections.

  • Eric Promislow

    Eric Promislow - 2013-06-27

    I'm thinking more here about arbitrarily placed carets and
    selections than edits against a single rectangular selection

  • Neil Hodgson

    Neil Hodgson - 2013-06-28

    Multiple selection can be useful where a rectangular selection wont work because some lines should be omitted. For example say there were some declaration+assignments and you want to initialize all the pointers to nullptr in

    char *cpBuffer = 0;
    int device = 3;
    int *pScroll = NULL;

    Click before the "0" and Ctrl+Click before the "NULL" then you can type "nullptr" but can only delete one character before hitting the ";". Allowing Ctrl+Delete would make this scenario work.

    One feature that may make multiple selection more widely applicable is to add a search box that will select each instance of a pattern. Here's a simple implementation for SciTE although you'd probably want to have some way to specify the part of each match to select.

    function OnStrip(control, change)
        if control == 2 and change == 1 then
            local pattern = scite.StripValue(1)
            local first = true
            for m in editor:match(pattern, SCFIND_REGEXP) do
                if first then
                    editor:SetSelection(m.pos+m.len, m.pos)
                    editor:AddSelection(m.pos+m.len, m.pos)
                first = false
    function ShowMultiSelector()
        scite.StripShow("!'&String:'{}((Select All))")
  • Neil Hodgson

    Neil Hodgson - 2016-09-05
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks