mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Multi-cursor tweaks
This commit is contained in:
parent
ba4d29d28d
commit
2ce4ec2e3f
22 changed files with 402 additions and 422 deletions
|
@ -340,8 +340,8 @@ namespace IDE
|
|||
Add("Zoom Out", new => gApp.Cmd_ZoomOut);
|
||||
Add("Zoom Reset", new => gApp.Cmd_ZoomReset);
|
||||
Add("Attach to Process", new => gApp.[Friend]DoAttach);
|
||||
Add("Select Next Match", new => gApp.Cmd_SelectNextMatch);
|
||||
Add("Skip Current Match and Select Next", new => gApp.Cmd_SkipCurrentMatchAndSelectNext);
|
||||
Add("Add Selection to Next Find Match", new => gApp.Cmd_AddSelectionToNextFindMatch);
|
||||
Add("Move Last Selection to Next Find Match", new => gApp.Cmd_MoveLastSelectionToNextFindMatch);
|
||||
|
||||
Add("Test Enable Console", new => gApp.Cmd_TestEnableConsole);
|
||||
}
|
||||
|
|
|
@ -5963,15 +5963,15 @@ namespace IDE
|
|||
}
|
||||
|
||||
[IDECommand]
|
||||
public void Cmd_SelectNextMatch()
|
||||
public void Cmd_AddSelectionToNextFindMatch()
|
||||
{
|
||||
GetActiveSourceEditWidgetContent()?.SelectNextMatch();
|
||||
GetActiveSourceEditWidgetContent()?.AddSelectionToNextFindMatch();
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void Cmd_SkipCurrentMatchAndSelectNext()
|
||||
public void Cmd_MoveLastSelectionToNextFindMatch()
|
||||
{
|
||||
GetActiveSourceEditWidgetContent()?.SkipCurrentMatchAndSelectNext();
|
||||
GetActiveSourceEditWidgetContent()?.MoveLastSelectionToNextFindMatch();
|
||||
}
|
||||
|
||||
public void UpdateMenuItem_HasActivePanel(IMenu menu)
|
||||
|
@ -8799,7 +8799,7 @@ namespace IDE
|
|||
c = c.ToLower;
|
||||
}*/
|
||||
|
||||
var prevSel = ewc.mSelection.Value;
|
||||
var prevSel = ewc.CurSelection.Value;
|
||||
|
||||
var str = scope String();
|
||||
ewc.GetSelectionText(str);
|
||||
|
@ -8818,7 +8818,7 @@ namespace IDE
|
|||
ewc.CreateMultiCursorUndoBatch("IDEApp.ChangeCase()");
|
||||
ewc.InsertAtCursor(str);
|
||||
|
||||
ewc.mSelection = prevSel;
|
||||
ewc.CurSelection = prevSel;
|
||||
}
|
||||
ewc.CloseMultiCursorUndoBatch();
|
||||
ewc.SetPrimaryTextCursor();
|
||||
|
|
|
@ -2310,7 +2310,7 @@ namespace IDE
|
|||
sel.mStartPos = (.)ewc.CursorTextPos;
|
||||
ewc.CursorLineAndColumn = prevPos;
|
||||
sel.mEndPos = (.)ewc.CursorTextPos;
|
||||
ewc.mSelection = sel;
|
||||
ewc.CurSelection = sel;
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
|
@ -2321,7 +2321,7 @@ namespace IDE
|
|||
return;
|
||||
|
||||
var ewc = textPanel.EditWidget.mEditWidgetContent;
|
||||
ewc.mSelection = null;
|
||||
ewc.CurSelection = null;
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
|
@ -2429,7 +2429,7 @@ namespace IDE
|
|||
{
|
||||
var text = ewc.mData.mText;
|
||||
|
||||
ewc.mSelection = EditSelection(startPos, startPos + 1);
|
||||
ewc.CurSelection = EditSelection(startPos, startPos + 1);
|
||||
ewc.DeleteSelection();
|
||||
|
||||
checkIdx = (.)startPos;
|
||||
|
@ -2443,7 +2443,7 @@ namespace IDE
|
|||
(text[checkIdx + 3].mChar == '*') &&
|
||||
(text[checkIdx + 4].mChar == '/'))
|
||||
{
|
||||
ewc.mSelection = EditSelection(checkIdx, checkIdx + 3);
|
||||
ewc.CurSelection = EditSelection(checkIdx, checkIdx + 3);
|
||||
ewc.DeleteSelection();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -707,6 +707,7 @@ namespace IDE
|
|||
public bool mFuzzyAutoComplete = false;
|
||||
public bool mShowLocatorAnim = true;
|
||||
public bool mHiliteCursorReferences = true;
|
||||
public bool mDebugMultiCursor = false;
|
||||
public bool mHiliteCurrentLine = false;
|
||||
public bool mLockEditing;
|
||||
public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable;// Only applicable for
|
||||
|
@ -858,6 +859,7 @@ namespace IDE
|
|||
|
||||
public void SetDefaults()
|
||||
{
|
||||
Add("Add Selection to Next Find Match", "Ctrl+D");
|
||||
Add("Autocomplete", "Ctrl+Space");
|
||||
Add("Bookmark Next", "F2");
|
||||
Add("Bookmark Prev", "Shift+F2");
|
||||
|
@ -882,7 +884,6 @@ namespace IDE
|
|||
Add("Comment Lines", "Ctrl+K, Ctrl+/");
|
||||
Add("Comment Toggle", "Ctrl+K, Ctrl+T");
|
||||
Add("Debug Comptime", "Alt+F7");
|
||||
Add("Duplicate Line", "Ctrl+D");
|
||||
Add("Find Class", "Alt+Shift+L");
|
||||
Add("Find in Document", "Ctrl+F");
|
||||
Add("Find in Files", "Ctrl+Shift+F");
|
||||
|
@ -896,6 +897,7 @@ namespace IDE
|
|||
Add("Make Uppercase", "Ctrl+Shift+U");
|
||||
Add("Match Brace Select", "Ctrl+Shift+RBracket");
|
||||
Add("Match Brace", "Ctrl+RBracket");
|
||||
//Add("Move Last Selection to Next Find Match, "Ctrl+K, Ctrl+D");
|
||||
Add("Move Line Down", "Alt+Shift+Down");
|
||||
Add("Move Line Up", "Alt+Shift+Up");
|
||||
Add("Move Statement Down", "Ctrl+Shift+Down");
|
||||
|
@ -1253,6 +1255,7 @@ namespace IDE
|
|||
{
|
||||
sd.Add("WakaTimeKey", mWakaTimeKey);
|
||||
sd.Add("EnableDevMode", mEnableDevMode);
|
||||
sd.Add("DebugMultiCursor", mEditorSettings.mDebugMultiCursor);
|
||||
}
|
||||
|
||||
using (sd.CreateObject("TutorialsFinished"))
|
||||
|
@ -1353,6 +1356,7 @@ namespace IDE
|
|||
{
|
||||
sd.Get("WakaTimeKey", mWakaTimeKey);
|
||||
sd.Get("EnableDevMode", ref mEnableDevMode);
|
||||
sd.Get("DebugMultiCursor", ref mEditorSettings.mDebugMultiCursor);
|
||||
}
|
||||
|
||||
using (sd.Open("TutorialsFinished"))
|
||||
|
|
|
@ -2834,10 +2834,10 @@ namespace IDE.ui
|
|||
if (focusChange)
|
||||
sourceEditWidgetContent.EnsureCursorVisible(true, true);
|
||||
|
||||
sourceEditWidgetContent.mSelection = null;
|
||||
sourceEditWidgetContent.CurSelection = null;
|
||||
if (fixitLen > 0)
|
||||
{
|
||||
sourceEditWidgetContent.mSelection = EditSelection(fixitIdx, fixitIdx + fixitLen);
|
||||
sourceEditWidgetContent.CurSelection = EditSelection(fixitIdx, fixitIdx + fixitLen);
|
||||
sourceEditWidgetContent.DeleteSelection();
|
||||
fixitLen = 0;
|
||||
}
|
||||
|
@ -3105,8 +3105,8 @@ namespace IDE.ui
|
|||
if ((prevText.Length > 0) && (insertText == prevText))
|
||||
continue;
|
||||
|
||||
sewc.mSelection = editSelection;
|
||||
sewc.mCursorTextPos = (int32)editSelection.MaxPos;
|
||||
sewc.CurSelection = editSelection;
|
||||
sewc.CurCursorTextPos = (int32)editSelection.MaxPos;
|
||||
|
||||
if (insertText.EndsWith("<>"))
|
||||
{
|
||||
|
|
|
@ -86,10 +86,10 @@ namespace IDE.ui
|
|||
bool isMultiline = false;
|
||||
|
||||
var content = editWidget.mEditWidgetContent;
|
||||
if (content.mSelection.HasValue)
|
||||
if (content.CurSelection.HasValue)
|
||||
{
|
||||
int selStart = content.mSelection.Value.MinPos;
|
||||
int selEnd = content.mSelection.Value.MaxPos;
|
||||
int selStart = content.CurSelection.Value.MinPos;
|
||||
int selEnd = content.CurSelection.Value.MaxPos;
|
||||
for (int i = selStart; i < selEnd; i++)
|
||||
{
|
||||
if (content.mData.mText[i].mChar == '\n')
|
||||
|
|
|
@ -745,7 +745,7 @@ namespace IDE.ui
|
|||
if (matches)
|
||||
{
|
||||
editWidgetContent.CursorTextPos = i;
|
||||
editWidgetContent.mSelection = EditSelection(i, i + mSearchOptions.mSearchString.Length);
|
||||
editWidgetContent.CurSelection = EditSelection(i, i + mSearchOptions.mSearchString.Length);
|
||||
var insertTextAction = new EditWidgetContent.InsertTextAction(editWidgetContent, mSearchOptions.mReplaceString, .None);
|
||||
insertTextAction.mMoveCursor = false;
|
||||
editWidgetContent.mData.mUndoManager.Add(insertTextAction);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace IDE.ui
|
|||
|
||||
if (isFinal)
|
||||
{
|
||||
editWidgetContent.Content.mSelection = null;
|
||||
editWidgetContent.Content.CurSelection = null;
|
||||
mSourceViewPanel.RecordHistoryLocation();
|
||||
}
|
||||
else
|
||||
|
@ -77,7 +77,7 @@ namespace IDE.ui
|
|||
int lineStart;
|
||||
int lineEnd;
|
||||
editWidgetContent.Content.GetLinePosition(line, out lineStart, out lineEnd);
|
||||
editWidgetContent.Content.mSelection = EditSelection(lineStart, lineEnd + 1);
|
||||
editWidgetContent.Content.CurSelection = EditSelection(lineStart, lineEnd + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -100,7 +100,7 @@ namespace IDE.ui
|
|||
void Cancel()
|
||||
{
|
||||
var editWidgetContent = mSourceViewPanel.mEditWidget;
|
||||
editWidgetContent.Content.mSelection = null;
|
||||
editWidgetContent.Content.CurSelection = null;
|
||||
|
||||
mSourceViewPanel.mEditWidget.Content.CursorTextPos = mCursorPos;
|
||||
mSourceViewPanel.mEditWidget.mVertPos.Set(mVertPos);
|
||||
|
|
|
@ -91,15 +91,15 @@ namespace IDE.ui
|
|||
|
||||
void CheckSelection()
|
||||
{
|
||||
if ((mSelection != null) && (!mSkipCheckSelection))
|
||||
if ((CurSelection != null) && (!mSkipCheckSelection))
|
||||
{
|
||||
if ((!IsInsideEntry(mSelection.Value.MinPos) && (IsInsideEntry(mSelection.Value.MaxPos))))
|
||||
if ((!IsInsideEntry(CurSelection.Value.MinPos) && (IsInsideEntry(CurSelection.Value.MaxPos))))
|
||||
{
|
||||
var immediateWidget = (ImmediateWidget)mEditWidget;
|
||||
mSelection = EditSelection(immediateWidget.mEntryStartPos.mIndex + 1, mSelection.Value.MaxPos);
|
||||
CurSelection = EditSelection(immediateWidget.mEntryStartPos.mIndex + 1, CurSelection.Value.MaxPos);
|
||||
}
|
||||
|
||||
if ((!IsInsideEntry(mSelection.Value.mStartPos)) || (!IsInsideEntry(mSelection.Value.mEndPos)))
|
||||
if ((!IsInsideEntry(CurSelection.Value.mStartPos)) || (!IsInsideEntry(CurSelection.Value.mEndPos)))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace IDE.ui
|
|||
|
||||
public override void Backspace()
|
||||
{
|
||||
if (!IsInsideEntry(mCursorTextPos - 1))
|
||||
if (!IsInsideEntry(CurCursorTextPos - 1))
|
||||
return;
|
||||
base.Backspace();
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ namespace IDE.ui
|
|||
immediateWidget.mHistoryIdx = -1;
|
||||
|
||||
CheckSelection();
|
||||
if (!IsInsideEntry(mCursorTextPos))
|
||||
if (!IsInsideEntry(CurCursorTextPos))
|
||||
{
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
MoveCursorToIdx(mData.mTextLength);
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ namespace IDE.ui
|
|||
if (c == '\x7F') // Ctrl+Backspace
|
||||
{
|
||||
var editWidgetContent = (ImmediateWidgetContent)mEditWidgetContent;
|
||||
if (!editWidgetContent.IsInsideEntry(editWidgetContent.mCursorTextPos - 1))
|
||||
if (!editWidgetContent.IsInsideEntry(editWidgetContent.CurCursorTextPos - 1))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ namespace IDE.ui
|
|||
|
||||
void SelectEntry()
|
||||
{
|
||||
mEditWidgetContent.mSelection = EditSelection(mEntryStartPos.mIndex + 1, mEditWidgetContent.mData.mTextLength);
|
||||
mEditWidgetContent.CurSelection = EditSelection(mEntryStartPos.mIndex + 1, mEditWidgetContent.mData.mTextLength);
|
||||
mEditWidgetContent.CursorTextPos = mEntryStartPos.mIndex + 1;
|
||||
}
|
||||
|
||||
|
@ -688,8 +688,8 @@ namespace IDE.ui
|
|||
{
|
||||
mEditWidgetContent.AppendText("> ");
|
||||
mEditWidgetContent.mData.mUndoManager.Clear();
|
||||
mEditWidgetContent.mSelection = null;
|
||||
mEditWidgetContent.mCursorTextPos = mEditWidgetContent.mData.mTextLength;
|
||||
mEditWidgetContent.CurSelection = null;
|
||||
mEditWidgetContent.CurCursorTextPos = mEditWidgetContent.mData.mTextLength;
|
||||
mEditWidgetContent.mIsReadOnly = false;
|
||||
mEntryStartPos.mWasDeleted = false;
|
||||
mEntryStartPos.mIndex = mEditWidgetContent.mData.mTextLength - 1;
|
||||
|
@ -702,8 +702,8 @@ namespace IDE.ui
|
|||
var subItem1 = listViewItem.GetSubItem(1);
|
||||
|
||||
var content = Content;
|
||||
let prevSelection = content.mSelection;
|
||||
defer { content.mSelection = prevSelection; }
|
||||
let prevSelection = content.CurSelection;
|
||||
defer { content.CurSelection = prevSelection; }
|
||||
|
||||
int line;
|
||||
int lineChar;
|
||||
|
@ -718,7 +718,7 @@ namespace IDE.ui
|
|||
replaceStr.Append(" ");
|
||||
replaceStr.Append(subItem1.Label);
|
||||
|
||||
content.mSelection = EditSelection(lineStart, lineEnd);
|
||||
content.CurSelection = EditSelection(lineStart, lineEnd);
|
||||
content.CursorTextPos = lineStart;
|
||||
content.InsertAtCursor(replaceStr);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace IDE.ui
|
|||
|
||||
public override void FocusForKeyboard()
|
||||
{
|
||||
mOutputWidget.mEditWidgetContent.mSelection = null;
|
||||
mOutputWidget.mEditWidgetContent.CurSelection = null;
|
||||
mOutputWidget.mEditWidgetContent.CursorLineAndColumn = EditWidgetContent.LineAndColumn(mOutputWidget.mEditWidgetContent.GetLineCount() - 1, 0);
|
||||
mOutputWidget.mEditWidgetContent.EnsureCursorVisible();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace IDE.ui
|
|||
int lineCheck = Math.Max(0, line + lineOfs);
|
||||
GetLinePosition(lineCheck, out lineStart, out lineEnd);
|
||||
|
||||
mSelection = EditSelection(lineStart, lineEnd);
|
||||
CurSelection = EditSelection(lineStart, lineEnd);
|
||||
var selectionText = scope String();
|
||||
GetSelectionText(selectionText);
|
||||
|
||||
|
@ -223,7 +223,7 @@ namespace IDE.ui
|
|||
{
|
||||
bool selectLine = lineOfs == 0;
|
||||
if (!selectLine)
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
CursorTextPos = lineStart;
|
||||
EnsureCursorVisible();
|
||||
return true;
|
||||
|
|
|
@ -2723,7 +2723,7 @@ namespace IDE.ui
|
|||
int lastDot = str.LastIndexOf('.');
|
||||
if (lastDot != -1)
|
||||
{
|
||||
mListView.mEditWidget.mEditWidgetContent.mSelection = .(0, lastDot);
|
||||
mListView.mEditWidget.mEditWidgetContent.CurSelection = .(0, lastDot);
|
||||
mListView.mEditWidget.mEditWidgetContent.CursorTextPos = lastDot;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ namespace IDE.ui
|
|||
var sourceContent = editWidget.Content as SourceEditWidgetContent;
|
||||
if (content.HasSelection())
|
||||
{
|
||||
int selStart = content.mSelection.Value.MinPos;
|
||||
int selEnd = content.mSelection.Value.MaxPos;
|
||||
int selStart = content.CurSelection.Value.MinPos;
|
||||
int selEnd = content.CurSelection.Value.MaxPos;
|
||||
bool isMultiline = false;
|
||||
for (int i = selStart; i < selEnd; i++)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ namespace IDE.ui
|
|||
mFindEditWidget.Content.SelectAll();
|
||||
}
|
||||
|
||||
content.mSelection = null;
|
||||
content.CurSelection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ namespace IDE.ui
|
|||
mHasNewActiveCursorPos = true;
|
||||
mLastActiveCursorPos = (int32)mEditWidget.Content.CursorTextPos;
|
||||
if (mEditWidget.Content.HasSelection())
|
||||
mLastActiveCursorPos = (int32)mEditWidget.Content.mSelection.Value.MinPos;
|
||||
mLastActiveCursorPos = (int32)mEditWidget.Content.CurSelection.Value.MinPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ namespace IDE.ui
|
|||
editWidgetContent.MoveCursorToIdx(mCurFindIdx + (int32)findText.Length, true, .QuickFind);
|
||||
|
||||
|
||||
editWidgetContent.mSelection = EditSelection(mCurFindIdx, mCurFindIdx + (int32)findText.Length);
|
||||
editWidgetContent.CurSelection = EditSelection(mCurFindIdx, mCurFindIdx + (int32)findText.Length);
|
||||
|
||||
/*for (int32 idx = mCurFindIdx; idx < mCurFindIdx + findText.Length; idx++)
|
||||
{
|
||||
|
@ -744,10 +744,10 @@ namespace IDE.ui
|
|||
EditSelection selection = EditSelection();
|
||||
selection.mStartPos = selStart;
|
||||
selection.mEndPos = selEnd + 1;
|
||||
ewc.mSelection = selection;
|
||||
ewc.CurSelection = selection;
|
||||
}
|
||||
else
|
||||
selStart = (.)ewc.mSelection.Value.MinPos;
|
||||
selStart = (.)ewc.CurSelection.Value.MinPos;
|
||||
EditWidgetContent.InsertFlags insertFlags = .NoMoveCursor | .NoRestoreSelectionOnUndo | .IsGroupPart;
|
||||
if (searchCount == 0)
|
||||
insertFlags |= .IsGroupStart;
|
||||
|
@ -851,7 +851,7 @@ namespace IDE.ui
|
|||
if (mSelectionStart != null)
|
||||
{
|
||||
if (mSelectionEnd != null)
|
||||
sourceContent.mSelection = .(mSelectionStart.mIndex, mSelectionEnd.mIndex);
|
||||
sourceContent.CurSelection = .(mSelectionStart.mIndex, mSelectionEnd.mIndex);
|
||||
if (sourceContent != null)
|
||||
sourceContent.PersistentTextPositions.Remove(mSelectionStart);
|
||||
DeleteAndNullify!(mSelectionStart);
|
||||
|
|
|
@ -319,7 +319,7 @@ namespace IDE.ui
|
|||
// then that would have removed the selection anyway so we don't do the full-select in that case
|
||||
if (ewc.CursorTextPos == mCursorPos)
|
||||
{
|
||||
ewc.mSelection = EditSelection(mStartIdx, mEndIdx);
|
||||
ewc.CurSelection = EditSelection(mStartIdx, mEndIdx);
|
||||
ewc.CursorTextPos = mEndIdx;
|
||||
}
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ namespace IDE.ui
|
|||
cursorPositions.Add((int32)sourceEditWidgetContent.CursorTextPos);
|
||||
}
|
||||
|
||||
var prevSelection = activeSourceEditWidgetContent.mSelection;
|
||||
var prevSelection = activeSourceEditWidgetContent.CurSelection;
|
||||
|
||||
for (int sourceIdx = 0; sourceIdx < mUpdatingProjectSources.Count; sourceIdx++)
|
||||
{
|
||||
|
@ -740,7 +740,7 @@ namespace IDE.ui
|
|||
|
||||
if ((mUpdateTextCount == 0) && (mKind == Kind.Rename))
|
||||
{
|
||||
activeSourceEditWidgetContent.mSelection = prevSelection;
|
||||
activeSourceEditWidgetContent.CurSelection = prevSelection;
|
||||
}
|
||||
|
||||
mUpdateTextCount++;
|
||||
|
|
|
@ -42,19 +42,19 @@ namespace IDE.ui
|
|||
editWidgetContent.mData.mUndoManager.Add(firstUndoAction);
|
||||
editWidgetContent.mData.mUndoManager.Add(new EditWidgetContent.SetCursorAction(editWidgetContent));
|
||||
|
||||
mVirtualCursorPos = editWidgetContent.mVirtualCursorPos;
|
||||
mVirtualCursorPos = editWidgetContent.CurVirtualCursorPos;
|
||||
mTrackedCursorPosition = new PersistentTextPosition((int32)editWidgetContent.CursorTextPos);
|
||||
editWidgetContent.PersistentTextPositions.Add(mTrackedCursorPosition);
|
||||
|
||||
if (editWidgetContent.HasSelection())
|
||||
{
|
||||
mSelStartPostion = new PersistentTextPosition(editWidgetContent.mSelection.Value.mStartPos);
|
||||
mSelStartPostion = new PersistentTextPosition(editWidgetContent.CurSelection.Value.mStartPos);
|
||||
editWidgetContent.PersistentTextPositions.Add(mSelStartPostion);
|
||||
|
||||
mSelEndPostion = new PersistentTextPosition(editWidgetContent.mSelection.Value.mEndPos);
|
||||
mSelEndPostion = new PersistentTextPosition(editWidgetContent.CurSelection.Value.mEndPos);
|
||||
editWidgetContent.PersistentTextPositions.Add(mSelEndPostion);
|
||||
}
|
||||
editWidgetContent.mSelection = null;
|
||||
editWidgetContent.CurSelection = null;
|
||||
}
|
||||
|
||||
public void Finish(UndoAction lastUndoAction = null)
|
||||
|
@ -70,7 +70,7 @@ namespace IDE.ui
|
|||
|
||||
if (mSelStartPostion != null)
|
||||
{
|
||||
editWidgetContent.mSelection = EditSelection(mSelStartPostion.mIndex, mSelEndPostion.mIndex);
|
||||
editWidgetContent.CurSelection = EditSelection(mSelStartPostion.mIndex, mSelEndPostion.mIndex);
|
||||
editWidgetContent.PersistentTextPositions.Remove(mSelEndPostion);
|
||||
delete mSelEndPostion;
|
||||
editWidgetContent.PersistentTextPositions.Remove(mSelStartPostion);
|
||||
|
@ -162,11 +162,11 @@ namespace IDE.ui
|
|||
g.FillRect(rect.mX, rect.mY, rect.mWidth, rect.mHeight);
|
||||
}
|
||||
|
||||
if ((mEditWidgetContent.mSelection != null) && (mCollapseIndex < mEditWidgetContent.mOrderedCollapseEntries.Count))
|
||||
if ((mEditWidgetContent.CurSelection != null) && (mCollapseIndex < mEditWidgetContent.mOrderedCollapseEntries.Count))
|
||||
{
|
||||
var collapseEntry = mEditWidgetContent.mOrderedCollapseEntries[mCollapseIndex];
|
||||
int32 startIdx = mEditWidgetContent.mData.mLineStarts[collapseEntry.mStartLine];
|
||||
if ((mEditWidgetContent.mSelection.Value.MinPos <= collapseEntry.mEndIdx) && (mEditWidgetContent.mSelection.Value.MaxPos >= startIdx))
|
||||
if ((mEditWidgetContent.CurSelection.Value.MinPos <= collapseEntry.mEndIdx) && (mEditWidgetContent.CurSelection.Value.MaxPos >= startIdx))
|
||||
{
|
||||
using (g.PushColor(mEditWidgetContent.GetSelectionColor(0)))
|
||||
g.FillRect(rect.mX, rect.mY, rect.mWidth, rect.mHeight);
|
||||
|
@ -563,11 +563,11 @@ namespace IDE.ui
|
|||
g.FillRect(rect.mX + 1, rect.mY + 1, rect.mWidth - 2, rect.mHeight - 2);
|
||||
}
|
||||
|
||||
if ((mEditWidgetContent.mSelection != null) && (mCollapseIndex < mEditWidgetContent.mOrderedCollapseEntries.Count))
|
||||
if ((mEditWidgetContent.CurSelection != null) && (mCollapseIndex < mEditWidgetContent.mOrderedCollapseEntries.Count))
|
||||
{
|
||||
var collapseEntry = mEditWidgetContent.mOrderedCollapseEntries[mCollapseIndex];
|
||||
int32 startIdx = mEditWidgetContent.mData.mLineStarts[collapseEntry.mStartLine];
|
||||
if ((mEditWidgetContent.mSelection.Value.MinPos <= collapseEntry.mEndIdx) && (mEditWidgetContent.mSelection.Value.MaxPos >= startIdx))
|
||||
if ((mEditWidgetContent.CurSelection.Value.MinPos <= collapseEntry.mEndIdx) && (mEditWidgetContent.CurSelection.Value.MaxPos >= startIdx))
|
||||
{
|
||||
using (g.PushColor(mEditWidgetContent.GetSelectionColor(0)))
|
||||
g.FillRect(rect.mX, rect.mY, rect.mWidth, rect.mHeight);
|
||||
|
@ -934,7 +934,7 @@ namespace IDE.ui
|
|||
UndoBatchStart undoBatchStart = new UndoBatchStart("applyDiff");
|
||||
editWidgetContent.mData.mUndoManager.Add(undoBatchStart);
|
||||
|
||||
editWidgetContent.mSelection = null;
|
||||
editWidgetContent.CurSelection = null;
|
||||
|
||||
int32 curSrcLineIdx = -1;
|
||||
List<TextLineSegment> deletedLineSegments = scope List<TextLineSegment>();
|
||||
|
@ -982,7 +982,7 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
editWidgetContent.mHadPersistentTextPositionDeletes = false;
|
||||
editWidgetContent.mSelection = EditSelection(pos, pos + len);
|
||||
editWidgetContent.CurSelection = EditSelection(pos, pos + len);
|
||||
editWidgetContent.DeleteSelection(false);
|
||||
|
||||
// If we have modified a section of text containing breakpoint (for example), this gets encoded by
|
||||
|
@ -1913,7 +1913,7 @@ namespace IDE.ui
|
|||
{
|
||||
int startPos;
|
||||
int endPos;
|
||||
mSelection.Value.GetAsForwardSelect(out startPos, out endPos);
|
||||
CurSelection.Value.GetAsForwardSelect(out startPos, out endPos);
|
||||
int line;
|
||||
int lineChar;
|
||||
GetLineCharAtIdx(startPos, out line, out lineChar);
|
||||
|
@ -2154,7 +2154,7 @@ namespace IDE.ui
|
|||
if ((HasSelection()) && (gApp.mSymbolReferenceHelper != null) && (gApp.mSymbolReferenceHelper.mKind == .Rename))
|
||||
{
|
||||
bool hasSymbolSelection = true;
|
||||
mSelection.Value.GetAsForwardSelect(var startPos, var endPos);
|
||||
CurSelection.Value.GetAsForwardSelect(var startPos, var endPos);
|
||||
var text = mEditWidget.mEditWidgetContent.mData.mText;
|
||||
for (int i = startPos; i < endPos; i++)
|
||||
{
|
||||
|
@ -2311,7 +2311,7 @@ namespace IDE.ui
|
|||
int maxLineIdx = 0;
|
||||
int maxLineCharIdx = 0;
|
||||
|
||||
var selection = mSelection.Value;
|
||||
var selection = CurSelection.Value;
|
||||
|
||||
GetLineCharAtIdx(selection.MinPos, out minLineIdx, out minLineCharIdx);
|
||||
GetLineCharAtIdx(selection.MaxPos, out maxLineIdx, out maxLineCharIdx);
|
||||
|
@ -2349,7 +2349,7 @@ namespace IDE.ui
|
|||
undoBatchStart = new UndoBatchStart("embeddedOpenCodeBlock");
|
||||
mData.mUndoManager.Add(undoBatchStart);
|
||||
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
CursorTextPos = i;
|
||||
InsertAtCursor("\n");
|
||||
embeddedEndIdx = i;
|
||||
|
@ -2422,7 +2422,7 @@ namespace IDE.ui
|
|||
EditSelection newSel = selection;
|
||||
|
||||
selection.MakeForwardSelect();
|
||||
mSelection = selection;
|
||||
CurSelection = selection;
|
||||
|
||||
int startAdjust = 0;
|
||||
int endAdjust = 0;
|
||||
|
@ -2562,7 +2562,7 @@ namespace IDE.ui
|
|||
if (undoBatchStart != null)
|
||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
|
||||
mSelection = newSel;
|
||||
CurSelection = newSel;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2761,8 +2761,8 @@ namespace IDE.ui
|
|||
if (!HasSelection())
|
||||
return false;
|
||||
|
||||
int minIdx = mSelection.Value.MinPos;
|
||||
int maxIdx = mSelection.Value.MaxPos;
|
||||
int minIdx = CurSelection.Value.MinPos;
|
||||
int maxIdx = CurSelection.Value.MaxPos;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -2798,7 +2798,7 @@ namespace IDE.ui
|
|||
|
||||
UndoBatchStart undoBatchStart = new UndoBatchStart("closeCodeBlock");
|
||||
mData.mUndoManager.Add(undoBatchStart);
|
||||
mSelection = EditSelection(maxIdx - 1, maxIdx);
|
||||
CurSelection = EditSelection(maxIdx - 1, maxIdx);
|
||||
GetLineCharAtIdx(maxIdx - 1, var endLine, var endLineChar);
|
||||
String endStr = scope .();
|
||||
ExtractLine(endLine, endStr);
|
||||
|
@ -2812,7 +2812,7 @@ namespace IDE.ui
|
|||
else
|
||||
DeleteSelection();
|
||||
|
||||
mSelection = EditSelection(minIdx, minIdx + 1);
|
||||
CurSelection = EditSelection(minIdx, minIdx + 1);
|
||||
GetLineCharAtIdx(minIdx, var startLine, var startLineChar);
|
||||
String startStr = scope .();
|
||||
ExtractLine(startLine, startStr);
|
||||
|
@ -2838,7 +2838,7 @@ namespace IDE.ui
|
|||
}
|
||||
CursorTextPos = startLineStart;
|
||||
|
||||
mSelection = EditSelection(startLineStart, endLineEnd);
|
||||
CurSelection = EditSelection(startLineStart, endLineEnd);
|
||||
|
||||
if (undoBatchStart != null)
|
||||
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||
|
@ -2857,7 +2857,7 @@ namespace IDE.ui
|
|||
|
||||
var startLineAndCol = CursorLineAndColumn;
|
||||
int startTextPos = CursorTextPos;
|
||||
var prevSelection = mSelection;
|
||||
var prevSelection = CurSelection;
|
||||
bool hadSelection = HasSelection();
|
||||
|
||||
if (!HasSelection())
|
||||
|
@ -2865,7 +2865,7 @@ namespace IDE.ui
|
|||
CursorToLineEnd();
|
||||
int cursorEndPos = CursorTextPos;
|
||||
CursorToLineStart(false);
|
||||
mSelection = EditSelection(CursorTextPos, cursorEndPos);
|
||||
CurSelection = EditSelection(CursorTextPos, cursorEndPos);
|
||||
}
|
||||
|
||||
if (HasSelection())
|
||||
|
@ -2876,9 +2876,9 @@ namespace IDE.ui
|
|||
setCursorAction.mCursorTextPos = (int32)startTextPos;
|
||||
mData.mUndoManager.Add(setCursorAction);
|
||||
|
||||
int minPos = mSelection.GetValueOrDefault().MinPos;
|
||||
int maxPos = mSelection.GetValueOrDefault().MaxPos;
|
||||
mSelection = null;
|
||||
int minPos = CurSelection.GetValueOrDefault().MinPos;
|
||||
int maxPos = CurSelection.GetValueOrDefault().MaxPos;
|
||||
CurSelection = null;
|
||||
|
||||
var str = scope String();
|
||||
ExtractString(minPos, maxPos - minPos, str);
|
||||
|
@ -2899,7 +2899,7 @@ namespace IDE.ui
|
|||
CursorTextPos = lastCharPos + 2;
|
||||
InsertAtCursor("*/");
|
||||
|
||||
mSelection = EditSelection(firstCharPos, lastCharPos + 4);
|
||||
CurSelection = EditSelection(firstCharPos, lastCharPos + 4);
|
||||
|
||||
if (startTextPos <= minPos)
|
||||
CursorLineAndColumn = startLineAndCol;
|
||||
|
@ -2907,7 +2907,7 @@ namespace IDE.ui
|
|||
CursorTextPos = startTextPos + 2;
|
||||
|
||||
if (!hadSelection)
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2935,7 +2935,7 @@ namespace IDE.ui
|
|||
SetTextCursor(cursor);
|
||||
|
||||
var startTextPos = CursorTextPos;
|
||||
var prevSelection = mSelection;
|
||||
var prevSelection = CurSelection;
|
||||
var hadSelection = HasSelection();
|
||||
var startLineAndCol = CursorLineAndColumn;
|
||||
if (!HasSelection())
|
||||
|
@ -2943,7 +2943,7 @@ namespace IDE.ui
|
|||
CursorToLineEnd();
|
||||
int cursorEndPos = CursorTextPos;
|
||||
CursorToLineStart(false);
|
||||
mSelection = .(CursorTextPos, cursorEndPos);
|
||||
CurSelection = .(CursorTextPos, cursorEndPos);
|
||||
}
|
||||
|
||||
var setCursorAction = new SetCursorAction(this);
|
||||
|
@ -2951,9 +2951,9 @@ namespace IDE.ui
|
|||
setCursorAction.mCursorTextPos = (int32)startTextPos;
|
||||
mData.mUndoManager.Add(setCursorAction);
|
||||
|
||||
int minPos = mSelection.Value.MinPos;
|
||||
int maxPos = mSelection.Value.MaxPos;
|
||||
mSelection = null;
|
||||
int minPos = CurSelection.Value.MinPos;
|
||||
int maxPos = CurSelection.Value.MaxPos;
|
||||
CurSelection = null;
|
||||
|
||||
while (minPos > 0)
|
||||
{
|
||||
|
@ -3070,7 +3070,7 @@ namespace IDE.ui
|
|||
appendedCount += str.Length;
|
||||
}
|
||||
}
|
||||
mSelection = EditSelection(minPos, maxPos);
|
||||
CurSelection = EditSelection(minPos, maxPos);
|
||||
|
||||
if (appendedCount > 0)
|
||||
CursorTextPos = startTextPos + appendedCount;
|
||||
|
@ -3078,7 +3078,7 @@ namespace IDE.ui
|
|||
CursorLineAndColumn = startLineAndCol;
|
||||
|
||||
if (!hadSelection)
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
|
||||
CloseMultiCursorUndoBatch();
|
||||
|
@ -3091,11 +3091,11 @@ namespace IDE.ui
|
|||
{
|
||||
if (!HasSelection())
|
||||
return;
|
||||
if (CursorTextPos >= mSelection.Value.MaxPos)
|
||||
CursorTextPos = mSelection.Value.MaxPos;
|
||||
if (mSelection.Value.MaxPos - mSelection.Value.MinPos <= 1)
|
||||
if (CursorTextPos >= CurSelection.Value.MaxPos)
|
||||
CursorTextPos = CurSelection.Value.MaxPos;
|
||||
if (CurSelection.Value.MaxPos - CurSelection.Value.MinPos <= 1)
|
||||
{
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3116,7 +3116,7 @@ namespace IDE.ui
|
|||
|
||||
int startTextPos = CursorTextPos;
|
||||
bool doLineComment = false;
|
||||
var prevSelection = mSelection;
|
||||
var prevSelection = CurSelection;
|
||||
var cursorAtEndPos = true;
|
||||
|
||||
LineAndColumn? startLineAndCol = CursorLineAndColumn;
|
||||
|
@ -3125,12 +3125,12 @@ namespace IDE.ui
|
|||
CursorToLineEnd();
|
||||
int cursorEndPos = CursorTextPos;
|
||||
CursorToLineStart(false);
|
||||
mSelection = EditSelection(CursorTextPos, cursorEndPos);
|
||||
CurSelection = EditSelection(CursorTextPos, cursorEndPos);
|
||||
doLineComment = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursorAtEndPos = (mSelection.Value.mStartPos == mCursorTextPos);
|
||||
cursorAtEndPos = (CurSelection.Value.mStartPos == CurCursorTextPos);
|
||||
}
|
||||
|
||||
if (HasSelection())
|
||||
|
@ -3142,9 +3142,9 @@ namespace IDE.ui
|
|||
setCursorAction.mCursorTextPos = (int32)startTextPos;
|
||||
mData.mUndoManager.Add(setCursorAction);
|
||||
|
||||
var minPos = mSelection.GetValueOrDefault().MinPos;
|
||||
var maxPos = mSelection.GetValueOrDefault().MaxPos;
|
||||
mSelection = null;
|
||||
var minPos = CurSelection.GetValueOrDefault().MinPos;
|
||||
var maxPos = CurSelection.GetValueOrDefault().MaxPos;
|
||||
CurSelection = null;
|
||||
|
||||
var str = scope String();
|
||||
ExtractString(minPos, (maxPos - minPos), str);
|
||||
|
@ -3165,7 +3165,7 @@ namespace IDE.ui
|
|||
CursorLineAndColumn = startLineAndCol.Value;
|
||||
|
||||
if (doComment == null)
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
|
||||
//return false; // not sure if this should be false in blank/only whitespace selection case
|
||||
continue;
|
||||
|
@ -3180,7 +3180,7 @@ namespace IDE.ui
|
|||
{
|
||||
if (SafeGetChar(i - 0) == '/' && SafeGetChar(i + 1) == '/')
|
||||
{
|
||||
mSelection = EditSelection(i - 0, i + 2);
|
||||
CurSelection = EditSelection(i - 0, i + 2);
|
||||
DeleteSelection();
|
||||
lastCharPos -= 2;
|
||||
while (i < maxPos && SafeGetChar(i) != '\n')
|
||||
|
@ -3194,20 +3194,20 @@ namespace IDE.ui
|
|||
startLineAndCol = null;
|
||||
CursorToLineEnd();
|
||||
int cursorEndPos = CursorTextPos;
|
||||
mSelection = .(minPos, cursorEndPos);
|
||||
CurSelection = .(minPos, cursorEndPos);
|
||||
}
|
||||
else if ((doComment != true) && trimmedStr.StartsWith("/*"))
|
||||
{
|
||||
didComment = true;
|
||||
if (trimmedStr.EndsWith("*/\n"))
|
||||
{
|
||||
mSelection = EditSelection(firstCharPos, firstCharPos + 2);
|
||||
CurSelection = EditSelection(firstCharPos, firstCharPos + 2);
|
||||
DeleteChar();
|
||||
mSelection = EditSelection(lastCharPos - 4, lastCharPos - 2);
|
||||
CurSelection = EditSelection(lastCharPos - 4, lastCharPos - 2);
|
||||
DeleteChar();
|
||||
|
||||
if (prevSelection != null)
|
||||
mSelection = EditSelection(firstCharPos, lastCharPos - 4);
|
||||
CurSelection = EditSelection(firstCharPos, lastCharPos - 4);
|
||||
}
|
||||
}
|
||||
else if (doComment != false)
|
||||
|
@ -3227,7 +3227,7 @@ namespace IDE.ui
|
|||
InsertAtCursor("*/");
|
||||
}
|
||||
|
||||
mSelection = EditSelection(firstCharPos, lastCharPos + 4);
|
||||
CurSelection = EditSelection(firstCharPos, lastCharPos + 4);
|
||||
if (startTextPos <= minPos)
|
||||
CursorLineAndColumn = startLineAndCol.Value;
|
||||
else
|
||||
|
@ -3236,25 +3236,25 @@ namespace IDE.ui
|
|||
}
|
||||
else
|
||||
{
|
||||
mSelection = prevSelection;
|
||||
CurSelection = prevSelection;
|
||||
}
|
||||
|
||||
if (startLineAndCol != null)
|
||||
CursorLineAndColumn = startLineAndCol.Value;
|
||||
|
||||
if (prevSelection == null)
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
|
||||
ClampCursor();
|
||||
FixSelection();
|
||||
|
||||
if (mSelection.HasValue)
|
||||
if (CurSelection.HasValue)
|
||||
{
|
||||
// Placing cursor where it was before, meaning
|
||||
// at the start or at the end of the selection.
|
||||
mCursorTextPos = (cursorAtEndPos)
|
||||
? (int32)mSelection.Value.mStartPos
|
||||
: (int32)mSelection.Value.mEndPos
|
||||
CurCursorTextPos = (cursorAtEndPos)
|
||||
? (int32)CurSelection.Value.mStartPos
|
||||
: (int32)CurSelection.Value.mEndPos
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -3273,7 +3273,7 @@ namespace IDE.ui
|
|||
int endPos;
|
||||
if (HasSelection())
|
||||
{
|
||||
mSelection.ValueRef.GetAsForwardSelect(out startPos, out endPos);
|
||||
CurSelection.ValueRef.GetAsForwardSelect(out startPos, out endPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3294,9 +3294,9 @@ namespace IDE.ui
|
|||
return;
|
||||
}
|
||||
|
||||
mSelection = EditSelection();
|
||||
mSelection.ValueRef.mStartPos = (int32)startPos;
|
||||
mSelection.ValueRef.mEndPos = (int32)endPos;
|
||||
CurSelection = EditSelection();
|
||||
CurSelection.ValueRef.mStartPos = (int32)startPos;
|
||||
CurSelection.ValueRef.mEndPos = (int32)endPos;
|
||||
DeleteSelection();
|
||||
|
||||
CursorTextPos = startPos;
|
||||
|
@ -3323,12 +3323,12 @@ namespace IDE.ui
|
|||
|
||||
var line = CursorLineAndColumn.mLine;
|
||||
var column = CursorLineAndColumn.mColumn;
|
||||
var prevCursorPos = mCursorTextPos;
|
||||
var prevCursorPos = CurCursorTextPos;
|
||||
|
||||
lineText.Clear();
|
||||
GetLineText(line, lineText);
|
||||
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
CursorLineAndColumn = LineAndColumn(line+1, 0);
|
||||
|
||||
InsertAtCursor("\n");
|
||||
|
@ -3601,8 +3601,8 @@ namespace IDE.ui
|
|||
|
||||
var prevCursorLineAndColumn = CursorLineAndColumn;
|
||||
var str = scope String();
|
||||
int startSelPos = mSelection.Value.MinPos;
|
||||
ExtractString(mSelection.Value.MinPos, mSelection.Value.Length, str);
|
||||
int startSelPos = CurSelection.Value.MinPos;
|
||||
ExtractString(CurSelection.Value.MinPos, CurSelection.Value.Length, str);
|
||||
DeleteSelection();
|
||||
|
||||
if (str.EndsWith('\n'))
|
||||
|
@ -3762,7 +3762,7 @@ namespace IDE.ui
|
|||
}
|
||||
GetLinePosition(endLineNum, ?, var lineEnd);
|
||||
|
||||
mSelection = .(lineStart, Math.Min(lineEnd + 1, mData.mTextLength));
|
||||
CurSelection = .(lineStart, Math.Min(lineEnd + 1, mData.mTextLength));
|
||||
|
||||
if (dir == .Down)
|
||||
MoveSelection(endLineNum + (int)dir, false);
|
||||
|
@ -3801,7 +3801,7 @@ namespace IDE.ui
|
|||
|
||||
mData.mUndoManager.Add(new SetCursorAction(this));
|
||||
|
||||
mSelection = .(lineStart, selEnd);
|
||||
CurSelection = .(lineStart, selEnd);
|
||||
|
||||
int toLine = Math.Clamp(lineNum + (int)dir, 0, GetLineCount());
|
||||
if (dir == .Down)
|
||||
|
@ -3907,14 +3907,14 @@ namespace IDE.ui
|
|||
{
|
||||
if (HasSelection())
|
||||
{
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (keyChar == '\b')
|
||||
{
|
||||
if (HasSelection())
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3957,10 +3957,10 @@ namespace IDE.ui
|
|||
if ((IsPrimaryTextCursor()) && (isEndingChar))
|
||||
{
|
||||
bool forceAsyncFinish = false;
|
||||
if (mCursorTextPos > 0)
|
||||
if (CurCursorTextPos > 0)
|
||||
{
|
||||
char8 c = mData.mText[mCursorTextPos - 1].mChar;
|
||||
var displayType = (SourceElementType)mData.mText[mCursorTextPos - 1].mDisplayTypeId;
|
||||
char8 c = mData.mText[CurCursorTextPos - 1].mChar;
|
||||
var displayType = (SourceElementType)mData.mText[CurCursorTextPos - 1].mDisplayTypeId;
|
||||
if ((displayType != .Comment) && (displayType != .Literal))
|
||||
{
|
||||
if ((c.IsLetterOrDigit) || (c == '_'))
|
||||
|
@ -4004,7 +4004,7 @@ namespace IDE.ui
|
|||
|
||||
if ((IsPrimaryTextCursor()) && (mAutoComplete != null) && (mAutoComplete.mAutoCompleteListWidget != null))
|
||||
{
|
||||
if ((mAutoComplete.mInsertEndIdx != -1) && (mAutoComplete.mInsertEndIdx != mCursorTextPos) && (keyChar != '\t') && (keyChar != '\r') && (keyChar != '\n'))
|
||||
if ((mAutoComplete.mInsertEndIdx != -1) && (mAutoComplete.mInsertEndIdx != CurCursorTextPos) && (keyChar != '\t') && (keyChar != '\r') && (keyChar != '\n'))
|
||||
doAutocomplete = false;
|
||||
|
||||
/*if ((mAutoComplete.IsInsertEmpty()) && (!mAutoComplete.mIsFixit) && (keyChar != '.') && (keyChar != '\t') && (keyChar != '\r'))
|
||||
|
@ -4134,13 +4134,13 @@ namespace IDE.ui
|
|||
if (!HasSelection())
|
||||
{
|
||||
// Select whitespace at the end of the line so we trim it as we InsertAtCursor
|
||||
mSelection = EditSelection(CursorTextPos, CursorTextPos);
|
||||
CurSelection = EditSelection(CursorTextPos, CursorTextPos);
|
||||
for (int checkIdx = beforeCursorLineText.Length - 1; checkIdx >= 0; checkIdx--)
|
||||
{
|
||||
char8 c = beforeCursorLineText[checkIdx];
|
||||
if (!c.IsWhiteSpace)
|
||||
break;
|
||||
mSelection.ValueRef.mStartPos--;
|
||||
CurSelection.ValueRef.mStartPos--;
|
||||
}
|
||||
insertFlags |= .NoRestoreSelectionOnUndo;
|
||||
}
|
||||
|
@ -4310,7 +4310,7 @@ namespace IDE.ui
|
|||
((keyChar == '"') || (keyChar == '\'') || (keyChar == ')') || (keyChar == ']') || (keyChar == '>') || (keyChar == '}')) &&
|
||||
(IsCurrentPairClosing(cursorTextPos, true)))
|
||||
{
|
||||
mJustInsertedCharPair = false;
|
||||
CurJustInsertedCharPair = false;
|
||||
CursorTextPos++;
|
||||
return;
|
||||
}
|
||||
|
@ -4371,9 +4371,9 @@ namespace IDE.ui
|
|||
UndoBatchStart undoBatchStart = new UndoBatchStart("blockSurround");
|
||||
mData.mUndoManager.Add(undoBatchStart);
|
||||
|
||||
int minPos = mSelection.GetValueOrDefault().MinPos;
|
||||
int maxPos = mSelection.GetValueOrDefault().MaxPos;
|
||||
mSelection = null;
|
||||
int minPos = CurSelection.GetValueOrDefault().MinPos;
|
||||
int maxPos = CurSelection.GetValueOrDefault().MaxPos;
|
||||
CurSelection = null;
|
||||
CursorTextPos = minPos;
|
||||
String insertStr = scope String();
|
||||
insertStr.Append(keyChar);
|
||||
|
@ -4557,19 +4557,19 @@ namespace IDE.ui
|
|||
int32 columnPos = (int32)(GetTabbedWidth(tabStartStr, 0) / mCharWidth + 0.001f);
|
||||
if (columnPos >= wantLineColumn + gApp.mSettings.mEditorSettings.mTabSize)
|
||||
{
|
||||
mSelection = EditSelection();
|
||||
mSelection.ValueRef.mEndPos = (int32)(cursorTextIdx - trimmedLineText.Length);
|
||||
CurSelection = EditSelection();
|
||||
CurSelection.ValueRef.mEndPos = (int32)(cursorTextIdx - trimmedLineText.Length);
|
||||
if (lineText.EndsWith(scope String(" ", trimmedLineText), StringComparison.Ordinal))
|
||||
mSelection.ValueRef.mStartPos = mSelection.Value.mEndPos - 4;
|
||||
CurSelection.ValueRef.mStartPos = CurSelection.Value.mEndPos - 4;
|
||||
else if (lineText.EndsWith(scope String("\t", trimmedLineText), StringComparison.Ordinal))
|
||||
mSelection.ValueRef.mStartPos = mSelection.Value.mEndPos - 1;
|
||||
if (mSelection.Value.mStartPos > 0)
|
||||
CurSelection.ValueRef.mStartPos = CurSelection.Value.mEndPos - 1;
|
||||
if (CurSelection.Value.mStartPos > 0)
|
||||
{
|
||||
CreateMultiCursorUndoBatch("SEWC.KeyChar(case)");
|
||||
DeleteSelection();
|
||||
CursorToLineEnd();
|
||||
}
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4593,9 +4593,9 @@ namespace IDE.ui
|
|||
insertStr.Append("else");
|
||||
|
||||
var cursorPos = CursorTextPos;
|
||||
mSelection = EditSelection();
|
||||
mSelection.ValueRef.mStartPos = (int32)cursorPos - 4;
|
||||
mSelection.ValueRef.mEndPos = (int32)cursorPos;
|
||||
CurSelection = EditSelection();
|
||||
CurSelection.ValueRef.mStartPos = (int32)cursorPos - 4;
|
||||
CurSelection.ValueRef.mEndPos = (int32)cursorPos;
|
||||
InsertAtCursor(insertStr, .NoRestoreSelectionOnUndo);
|
||||
|
||||
//var indentTextAction = new EditWidgetContent.IndentTextAction(this);
|
||||
|
@ -4610,7 +4610,7 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
mCursorImplicitlyMoved = true;
|
||||
CurCursorImplicitlyMoved = true;
|
||||
}
|
||||
|
||||
public void ShowAutoComplete(bool isUserRequested)
|
||||
|
@ -4685,9 +4685,9 @@ namespace IDE.ui
|
|||
return;
|
||||
}
|
||||
|
||||
if ((keyCode == KeyCode.Escape) && (mSelection != null) && (mSelection.Value.HasSelection))
|
||||
if ((keyCode == KeyCode.Escape) && (CurSelection != null) && (CurSelection.Value.HasSelection))
|
||||
{
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
|
||||
if (((keyCode == KeyCode.Up) || (keyCode == KeyCode.Down) || (keyCode == KeyCode.PageUp) || (keyCode == KeyCode.PageDown)))
|
||||
|
@ -4767,13 +4767,13 @@ namespace IDE.ui
|
|||
{
|
||||
if (mWidgetWindow.IsKeyDown(.Shift))
|
||||
{
|
||||
if (mSelection == null)
|
||||
mSelection = .(CursorTextPos, wantCursorPos);
|
||||
if (CurSelection == null)
|
||||
CurSelection = .(CursorTextPos, wantCursorPos);
|
||||
else
|
||||
mSelection.ValueRef.mEndPos = (.)wantCursorPos;
|
||||
CurSelection.ValueRef.mEndPos = (.)wantCursorPos;
|
||||
}
|
||||
else
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
|
||||
CursorTextPos = wantCursorPos;
|
||||
return;
|
||||
|
@ -4820,8 +4820,8 @@ namespace IDE.ui
|
|||
|
||||
void ReplaceWord(int leftIdx, int rightIdx, String origWord, String newWord)
|
||||
{
|
||||
mSelection.ValueRef.mStartPos = (int32)leftIdx;
|
||||
mSelection.ValueRef.mEndPos = (int32)rightIdx;
|
||||
CurSelection.ValueRef.mStartPos = (int32)leftIdx;
|
||||
CurSelection.ValueRef.mEndPos = (int32)rightIdx;
|
||||
InsertAtCursor(newWord, .NoRestoreSelectionOnUndo);
|
||||
}
|
||||
|
||||
|
@ -5013,9 +5013,9 @@ namespace IDE.ui
|
|||
BfPassInstance passInstance = null;
|
||||
BfParser parser = null;
|
||||
|
||||
if ((mSelection != null) &&
|
||||
(textIdx >= mSelection.Value.MinPos) &&
|
||||
(textIdx < mSelection.Value.MaxPos))
|
||||
if ((CurSelection != null) &&
|
||||
(textIdx >= CurSelection.Value.MinPos) &&
|
||||
(textIdx < CurSelection.Value.MaxPos))
|
||||
{
|
||||
GetSelectionText(debugExpr);
|
||||
}
|
||||
|
@ -5624,7 +5624,7 @@ namespace IDE.ui
|
|||
{
|
||||
base.ClampCursor();
|
||||
|
||||
if (mVirtualCursorPos == null)
|
||||
if (CurVirtualCursorPos == null)
|
||||
return;
|
||||
if (gApp.mSettings.mEditorSettings.mFreeCursorMovement)
|
||||
return;
|
||||
|
@ -5640,7 +5640,7 @@ namespace IDE.ui
|
|||
GetLineText(line, curLineStr);
|
||||
int32 lineEnd = (int32)curLineStr.NumCodePoints;
|
||||
|
||||
mVirtualCursorPos.ValueRef.mColumn = (.)Math.Min(mVirtualCursorPos.Value.mColumn, Math.Max(virtualEnd, lineEnd));
|
||||
CurVirtualCursorPos.ValueRef.mColumn = (.)Math.Min(CurVirtualCursorPos.Value.mColumn, Math.Max(virtualEnd, lineEnd));
|
||||
}
|
||||
|
||||
bool CheckCollapseOpen(int checkLine, CursorMoveKind cursorMoveKind = .Unknown)
|
||||
|
@ -5682,14 +5682,14 @@ namespace IDE.ui
|
|||
{
|
||||
bool hadSelection = HasSelection();
|
||||
|
||||
if ((dir > 0) && (HasSelection()) && (mSelection.Value.Length > 1) && (!mWidgetWindow.IsKeyDown(.Shift)))
|
||||
if ((dir > 0) && (HasSelection()) && (CurSelection.Value.Length > 1) && (!mWidgetWindow.IsKeyDown(.Shift)))
|
||||
{
|
||||
GetLineCharAtIdx(mSelection.Value.MaxPos - 1, var maxLine, ?);
|
||||
GetLineCharAtIdx(CurSelection.Value.MaxPos - 1, var maxLine, ?);
|
||||
if (IsLineCollapsed(maxLine))
|
||||
{
|
||||
if (hadSelection)
|
||||
{
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
CursorToLineEnd();
|
||||
return true;
|
||||
}
|
||||
|
@ -5705,7 +5705,7 @@ namespace IDE.ui
|
|||
CursorLineAndColumn = .(anchorLine, 0);
|
||||
base.CursorToLineEnd();
|
||||
if ((mWidgetWindow.IsKeyDown(.Shift)) && (HasSelection()))
|
||||
mSelection.ValueRef.mEndPos = (.)CursorTextPos;
|
||||
CurSelection.ValueRef.mEndPos = (.)CursorTextPos;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5733,13 +5733,13 @@ namespace IDE.ui
|
|||
mSourceViewPanel?.mQuickFind?.SetFindIdx(CursorTextPos, !moveKind.IsFromTyping);
|
||||
}
|
||||
|
||||
if (mVirtualCursorPos != null)
|
||||
if (CurVirtualCursorPos != null)
|
||||
{
|
||||
CheckCollapseOpen(mVirtualCursorPos.Value.mLine, moveKind);
|
||||
CheckCollapseOpen(CurVirtualCursorPos.Value.mLine, moveKind);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLineCharAtIdx(mCursorTextPos, var checkLine, ?);
|
||||
GetLineCharAtIdx(CurCursorTextPos, var checkLine, ?);
|
||||
CheckCollapseOpen(checkLine, moveKind);
|
||||
}
|
||||
|
||||
|
@ -6735,12 +6735,12 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
int32 startIdx = mData.mLineStarts[entry.mStartLine];
|
||||
if ((!wantOpen) && (mSelection != null) && (mSelection.Value.MinPos >= startIdx) && (mSelection.Value.MinPos <= entry.mEndIdx))
|
||||
if ((!wantOpen) && (CurSelection != null) && (CurSelection.Value.MinPos >= startIdx) && (CurSelection.Value.MinPos <= entry.mEndIdx))
|
||||
{
|
||||
if (mSelection.Value.MaxPos > entry.mEndIdx + 1)
|
||||
mSelection = .(entry.mEndIdx + 1, mSelection.Value.MaxPos);
|
||||
if (CurSelection.Value.MaxPos > entry.mEndIdx + 1)
|
||||
CurSelection = .(entry.mEndIdx + 1, CurSelection.Value.MaxPos);
|
||||
else
|
||||
mSelection = null;
|
||||
CurSelection = null;
|
||||
}
|
||||
|
||||
if ((!wantOpen) && (cursorLineAndColumn.mLine >= entry.mStartLine) && (cursorLineAndColumn.mLine <= entry.mEndLine))
|
||||
|
|
|
@ -887,7 +887,7 @@ namespace IDE.ui
|
|||
return false;
|
||||
}
|
||||
int32 cursorPos = data.GetInt("CursorPos");
|
||||
mEditWidget.Content.mCursorTextPos = Math.Min(cursorPos, mEditWidget.mEditWidgetContent.mData.mTextLength);
|
||||
mEditWidget.Content.CurCursorTextPos = Math.Min(cursorPos, mEditWidget.mEditWidgetContent.mData.mTextLength);
|
||||
mDesiredVertPos = data.GetFloat("VertPos");
|
||||
|
||||
return true;
|
||||
|
@ -2462,10 +2462,10 @@ namespace IDE.ui
|
|||
mEditWidget.Content.CursorTextPos = searchIdx;
|
||||
if (mWidgetWindow.IsKeyDown(KeyCode.Shift))
|
||||
{
|
||||
mEditWidget.Content.mSelection = EditSelection(cursorStartPos, mEditWidget.Content.CursorTextPos);
|
||||
mEditWidget.Content.CurSelection = EditSelection(cursorStartPos, mEditWidget.Content.CursorTextPos);
|
||||
}
|
||||
else
|
||||
mEditWidget.Content.mSelection = null;
|
||||
mEditWidget.Content.CurSelection = null;
|
||||
mEditWidget.Content.CursorMoved();
|
||||
mEditWidget.Content.EnsureCursorVisible();
|
||||
break;
|
||||
|
@ -2522,14 +2522,14 @@ namespace IDE.ui
|
|||
|
||||
int32 prevLine = mEditWidget.Content.CursorLineAndColumn.mLine;
|
||||
|
||||
mEditWidget.Content.mSelection = null;
|
||||
mEditWidget.Content.CurSelection = null;
|
||||
|
||||
int wantCursorPos = Math.Min(mEditWidget.Content.mData.mTextLength - 1, cursorIdx);
|
||||
if (wantCursorPos >= 0)
|
||||
mEditWidget.Content.CursorTextPos = wantCursorPos;
|
||||
mEditWidget.Content.CursorMoved();
|
||||
mEditWidget.Content.EnsureCursorVisible(true, true);
|
||||
mEditWidget.Content.mCursorImplicitlyMoved = true;
|
||||
mEditWidget.Content.CurCursorImplicitlyMoved = true;
|
||||
if (mJustShown) // Jump to whatever position we're scrolling to
|
||||
{
|
||||
mEditWidget.mVertPos.mPct = 1.0f;
|
||||
|
@ -5187,7 +5187,7 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
if ((mEditWidget.Content.HasSelection()) && (!ignoreSelection))
|
||||
parser.ReformatInto(mEditWidget, mEditWidget.Content.mSelection.Value.MinPos, mEditWidget.Content.mSelection.Value.MaxPos);
|
||||
parser.ReformatInto(mEditWidget, mEditWidget.Content.CurSelection.Value.MinPos, mEditWidget.Content.CurSelection.Value.MaxPos);
|
||||
else
|
||||
parser.ReformatInto(mEditWidget, 0, text.Length);
|
||||
|
||||
|
@ -5409,9 +5409,9 @@ namespace IDE.ui
|
|||
|
||||
bool doSimpleMouseover = false;
|
||||
|
||||
if ((editWidgetContent.mSelection != null) &&
|
||||
(textIdx >= editWidgetContent.mSelection.Value.MinPos) &&
|
||||
(textIdx < editWidgetContent.mSelection.Value.MaxPos))
|
||||
if ((editWidgetContent.CurSelection != null) &&
|
||||
(textIdx >= editWidgetContent.CurSelection.Value.MinPos) &&
|
||||
(textIdx < editWidgetContent.CurSelection.Value.MaxPos))
|
||||
{
|
||||
debugExpr = scope:: String();
|
||||
editWidgetContent.GetSelectionText(debugExpr);
|
||||
|
@ -6827,7 +6827,7 @@ namespace IDE.ui
|
|||
int cursorIdx = sourceEditWidgetContent.CursorTextPos;
|
||||
|
||||
bool hasFlag = false;
|
||||
if (!sourceEditWidgetContent.mVirtualCursorPos.HasValue)
|
||||
if (!sourceEditWidgetContent.CurVirtualCursorPos.HasValue)
|
||||
{
|
||||
for (int32 ofs = -1; ofs <= 0; ofs++)
|
||||
{
|
||||
|
@ -6866,7 +6866,7 @@ namespace IDE.ui
|
|||
if ((gApp.mSettings.mEditorSettings.mHiliteCursorReferences) && (!gApp.mDeterministic) && (HasFocus(true)) &&
|
||||
((mProjectSource != null) || (mEmbedKind != .None)) /*&& (IDEApp.sApp.mSymbolReferenceHelper == null)*/)
|
||||
{
|
||||
if ((mEditWidget.mHasFocus) && (mIsBeefSource) && (sourceEditWidgetContent.mCursorStillTicks == 10) && (!sourceEditWidgetContent.mCursorImplicitlyMoved) && (!sourceEditWidgetContent.mVirtualCursorPos.HasValue))
|
||||
if ((mEditWidget.mHasFocus) && (mIsBeefSource) && (sourceEditWidgetContent.mCursorStillTicks == 10) && (!sourceEditWidgetContent.CurCursorImplicitlyMoved) && (!sourceEditWidgetContent.CurVirtualCursorPos.HasValue))
|
||||
{
|
||||
var symbolReferenceHelper = IDEApp.sApp.mSymbolReferenceHelper;
|
||||
if (symbolReferenceHelper == null)
|
||||
|
|
|
@ -347,7 +347,7 @@ namespace IDE.ui
|
|||
int lineCount = 1;
|
||||
|
||||
var data = activeEditWidget.mEditWidgetContent.mData;
|
||||
var sel = activeEditWidget.mEditWidgetContent.mSelection.GetValueOrDefault();
|
||||
var sel = activeEditWidget.mEditWidgetContent.CurSelection.GetValueOrDefault();
|
||||
for (int i in sel.MinPos..<sel.MaxPos-1)
|
||||
{
|
||||
var c = data.mText[i].mChar;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace IDE.ui
|
|||
var editWidget = EditWidget;
|
||||
if (editWidget.Content.HasSelection())
|
||||
{
|
||||
editWidget.Content.mSelection = null;
|
||||
editWidget.Content.CurSelection = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1595,7 +1595,7 @@ namespace IDE.ui
|
|||
String textPosString = scope String();
|
||||
if (mEditWidget.Content.HasSelection())
|
||||
{
|
||||
var selection = mEditWidget.Content.mSelection;
|
||||
var selection = mEditWidget.Content.CurSelection;
|
||||
textPosString.AppendF("Start {0} Len {1}", selection.Value.MinPos, selection.Value.MaxPos - selection.Value.MinPos);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue