SourceForge has been redesigned. Learn more.

#27 rectangular editing


For editing datalists and eg. declaring larger lists
of variables of the same type I think it is most
comfortable to have a multiline cursor.
It should act like the Rectangular selection already
implemented, you can select an rectangular area or a
number of lines in which you want to type.
Nowadays I can select an Area, if I start typing all
selected is deleted and the typed appears only in the
line where the cursor is.
I would appreciate it very much if I would be possible
to alter the whole selection at the same time.


  • Neil Hodgson

    Neil Hodgson - 2002-04-17
    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
  • Neil Hodgson

    Neil Hodgson - 2002-04-17

    Logged In: YES

    There have been a couple of suggestions for this and I'll
    accept a patch but don't find it compelling enough to
    implement myself.

  • Thomas Ruschival

    Logged In: YES

    Unfortunately I am not a C++ hacker....Usually I write Perl
    scripts the only real Programming language I am able to
    code is Java and more or less PL/SQL.
    So it would be very nice of a C++ Guru or a fary to fulfill
    my whish :-) if he is bored on a Sunday afternoon.

  • Nobody/Anonymous

    Logged In: NO

    I have written code which does this. I patch scintilla's Editor.cxx in each program that uses it and ships code. I'd really like this feature to be in the standard scintilla release. It only took a few lines to do and helps me in my work (I have lots of tables that line up in columns which sometimes need a comma added, or names changed. I find it much faster than trying to figure out a RegEx which might work.

    I use it almost every coding session.

    In the optimistic case that this code gets used, or is the start of a professional solution ( In the interest of getting it done, it is not exactly the most efficient in its present stage, but it works fine for me <so far> )... The technicalities of generating a patch are a bit beyond me, so the actual cut and paste version is given here.

    in Editor.cxx at about line 3356 in the function listed below...

    void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
    bool wasSelection = currentPos != anchor;
    <<<==== insert new code here.
    bool charReplaceAction = false;

    insert the following between the bool wasSelection and ClearSelection() lines.

    if(wasSelection && selType == selRectangle ) {
    int startPos;
    int endPos;

    int c1 = pdoc->GetColumn(currentPos);
    int c2 = pdoc->GetColumn(anchor);
    int offset = c1 < c2 ? c1 : c2;

    SelectionLineIterator lineIterator(this, false);
    while (lineIterator.Iterate()) {
    startPos = lineIterator.startPos;
    endPos = lineIterator.endPos;

    if(pdoc->GetColumn(endPos) >= offset){
    unsigned int chars = lineIterator.endPos - startPos;
    if (0 != chars) {
    pdoc->DeleteChars(startPos, chars);
    pdoc->InsertString(startPos, s, len);
    anchor += len;
    currentPos += len;
    else {
    /// then, have the else clause end just before EnsureCaretVisible()
    // Avoid blinking during rapid typing:


  • Neil Hodgson

    Neil Hodgson - 2007-02-02

    Logged In: YES
    Originator: NO

    There's no visual indication that there is a multiline caret.

  • Nobody/Anonymous

    Logged In: NO

    True, the "caret" gets mighty skinny, but the user has specifically selected the area of interest. It lasts only as long as the insert/replace characters are input. It should not be a suprise when it does what it does.

    Plus, currently, if one selects a zero-width rectangle, there is no indication that that exists either.

    So one can copy (or cut) a rectangle, then select a zero-width rectangle elsewhere, (with no visible indication!) and then paste, it does what the user expects; pastes the previous rectangle in the new place as an insertion.

    So my code is not terribly different from that which already exists, I think. Plus it makes me happy...


  • Neil Hodgson

    Neil Hodgson - 2010-01-20
    • milestone: --> Completed
    • status: open --> closed
  • Neil Hodgson

    Neil Hodgson - 2010-01-20

    Feature added in 2.0.


Log in to post a comment.