Kusto Explorer: Fix the Line copy/paste by inserting and pushing the current line down

Microsoft

The current feature I use is copy/paste a line, but it inserts the line directly where my cursor is located instead of creating a new line. Editors like VS Code and SSMS already support this.

 

Repro:

  1. Have a line of code in Kusto Explorer
  2. Use the shortcut for copy/paste
  3. The line is pasted where my cursor was.

Homiak_0-1633623179465.png

Thanks,

Jon

2 Replies
We utilize OpenSource: AvalonEdit.
If you're interested in making this change - the code handling OnCopy/OnPaste can be found here:
https://github.com/icsharpcode/AvalonEdit/blob/master/ICSharpCode.AvalonEdit/Editing/EditingCommandH...

We will put this item on a backlog as well.

@Alexander Sloutsky 
I think my intended outcome is supposed to happen in the OnPaste function, but it's not working maybe? The Copy and Cut functions look like they're getting the full line properly.

// Line 437
bool fullLine = textArea.Options.CutCopyWholeLine && dataObject.GetDataPresent(LineSelectedType);

// Line 440
if (fullLine) {
    DocumentLine currentLine = textArea.Document.GetLineByNumber(textArea.Caret.Line);
    if (textArea.ReadOnlySectionProvider.CanInsert(currentLine.Offset)) {
        textArea.Document.Insert(currentLine.Offset, text);
    }
}