Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple cursors in Scintilla?
#1
I believe there is some support for multiple cursors in scintilla.  At least I have found some stuff when searching.  Is it possible to get any "vertical editing" capabilities?  Right now I usually just copy code, paste it in VSCode or Sublime Text and then do the multi-edit in there.  Especially since there are cool vertical text editing plugins like "text pastry" for autoincrementing etc.

Thoughts?
#2
Code:
Copy      Help
// script "Multiple selections in LA.cs"
/// Enables multiple selections in the LA code editor.
/// To auto-enable for each document, add this line in Options -> General -> Run scripts...: Multiple selections in LA.cs
///
/// Does not implement "select all matching words".
/// Scintilla also supports rectangular selections, but this code does not enable it.
/// More info: https://www.scintilla.org/ScintillaDoc.html#MultipleSelectionAndVirtualSpace
///
/// This code is for LA 0.12. In 0.13 will be different.
///
///
The most recent selection is the main selection.
/// Additional selections have thinner caret.
///
/// Ctrl+click - create new empty selection.
/// Ctrl+doubleclick or Ctrl+drag - create new selection.
/// Esc - single selection.
/// When multiple selections are active:
/// - Changing text in one changes text in all.
/// - Pastes in all.
/// - Copies from all without a separator.

/*/
role editorExtension;
testInternal Au.Controls,Au.Editor;
r Au.Controls.dll;
r Au.Editor.dll;
/*/


using static Au.Controls.Sci;
using Au.Controls;

if (App.Wmain.IsLoaded) _Init(); else App.Wmain.Loaded += (_, _) => _Init();

void _Init() {
    _InitDoc();
    Panels.Editor.ZActiveDocChanged += _InitDoc;
}


void _InitDoc() {
    var d = Panels.Editor.ZActiveDoc;
    if (d == null || 0 != d.Call(SCI_GETMULTIPLESELECTION)) return;
    //print.it("_InitDoc", d);
    
    d.Call(SCI_SETMULTIPLESELECTION, true);
    d.Call(SCI_SETADDITIONALSELECTIONTYPING, true);
    d.Call(SCI_SETMULTIPASTE, 1);
}


Forum Jump:


Users browsing this thread: 1 Guest(s)