1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Merge pull request #2229 from kallisto56/master

Feature: Multi-Cursors
This commit is contained in:
Brian Fiete 2025-05-25 11:21:35 +02:00 committed by GitHub
commit ba4d29d28d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1786 additions and 531 deletions

View file

@ -4300,6 +4300,7 @@ namespace IDE
var sourceViewPanel = GetActiveSourceViewPanel();
if (sourceViewPanel != null)
{
sourceViewPanel.EditWidget.Content.RemoveSecondaryTextCursors();
sourceViewPanel.GotoLine();
return;
}
@ -5479,7 +5480,7 @@ namespace IDE
if (ewc.HasSelection())
ewc.GetSelectionText(debugExpr);
else
sourceViewPanel.GetDebugExpressionAt(ewc.CursorTextPos, debugExpr);
sourceViewPanel.GetDebugExpressionAt(ewc.mTextCursors.Front.mCursorTextPos, debugExpr);
dialog.Init(debugExpr);
}
else if (let immediatePanel = activePanel as ImmediatePanel)
@ -5961,6 +5962,18 @@ namespace IDE
ToggleCheck(ideCommand.mMenuItem, ref mTestEnableConsole);
}
[IDECommand]
public void Cmd_SelectNextMatch()
{
GetActiveSourceEditWidgetContent()?.SelectNextMatch();
}
[IDECommand]
public void Cmd_SkipCurrentMatchAndSelectNext()
{
GetActiveSourceEditWidgetContent()?.SkipCurrentMatchAndSelectNext();
}
public void UpdateMenuItem_HasActivePanel(IMenu menu)
{
menu.SetDisabled(GetActivePanel() == null);
@ -7862,6 +7875,7 @@ namespace IDE
if (!sourceViewPanel.[Friend]mWantsFullRefresh)
sourceViewPanel.UpdateQueuedEmitShowData();
sourceViewPanel.EditWidget?.Content.RemoveSecondaryTextCursors();
return sourceViewPanel;
}
}
@ -7873,6 +7887,7 @@ namespace IDE
svTabButton.mIsTemp = true;
sourceViewPanel.ShowHotFileIdx(showHotIdx);
sourceViewPanel.ShowFileLocation(refHotIdx, Math.Max(0, line), Math.Max(0, column), hilitePosition);
sourceViewPanel.EditWidget?.Content.RemoveSecondaryTextCursors();
return sourceViewPanel;
}
@ -8768,38 +8783,45 @@ namespace IDE
return;
var ewc = sourceViewPanel.mEditWidget.mEditWidgetContent;
if (!ewc.HasSelection())
return;
/*ewc.mSelection.Value.GetAsForwardSelect(var startPos, var endPos);
for (int i = startPos; i < endPos; i++)
for (var cursor in ewc.mTextCursors)
{
var c = ref ewc.mData.mText[i].mChar;
ewc.SetTextCursor(cursor);
if (!ewc.HasSelection())
continue;
/*ewc.mSelection.Value.GetAsForwardSelect(var startPos, var endPos);
for (int i = startPos; i < endPos; i++)
{
var c = ref ewc.mData.mText[i].mChar;
if (toUpper)
c = c.ToUpper;
else
c = c.ToLower;
}*/
var prevSel = ewc.mSelection.Value;
var str = scope String();
ewc.GetSelectionText(str);
var prevStr = scope String();
prevStr.Append(str);
if (toUpper)
c = c.ToUpper;
str.ToUpper();
else
c = c.ToLower;
}*/
str.ToLower();
var prevSel = ewc.mSelection.Value;
if (str == prevStr)
continue;
var str = scope String();
ewc.GetSelectionText(str);
ewc.CreateMultiCursorUndoBatch("IDEApp.ChangeCase()");
ewc.InsertAtCursor(str);
var prevStr = scope String();
prevStr.Append(str);
if (toUpper)
str.ToUpper();
else
str.ToLower();
if (str == prevStr)
return;
ewc.InsertAtCursor(str);
ewc.mSelection = prevSel;
ewc.mSelection = prevSel;
}
ewc.CloseMultiCursorUndoBatch();
ewc.SetPrimaryTextCursor();
}
public bool IsFilteredOut(String fileName)