1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Removed System.Tuple type

This commit is contained in:
Brian Fiete 2020-09-06 05:27:37 -07:00
parent e37e1ac687
commit d11b09dd07
6 changed files with 316 additions and 64 deletions

View file

@ -255,8 +255,8 @@ namespace Beefy.widgets
public class IndentTextAction : TextAction
{
// InsertCharList is for block indent, RemoveCharList is for unindent (shift-tab)
public List<Tuple<int32, char8>> mRemoveCharList = new List<Tuple<int32, char8>>() ~ delete _;
public List<Tuple<int32, char8>> mInsertCharList = new List<Tuple<int32, char8>>() ~ delete _;
public List<(int32, char8)> mRemoveCharList = new .() ~ delete _;
public List<(int32, char8)> mInsertCharList = new .() ~ delete _;
public EditSelection mNewSelection;
public this(EditWidgetContent editWidget)
@ -272,13 +272,13 @@ namespace Beefy.widgets
{
var idxChar = mRemoveCharList[idx];
editWidgetContent.InsertText(idxChar.Item1, ToStackString!(idxChar.Item2));
editWidgetContent.InsertText(idxChar.0, ToStackString!(idxChar.1));
}
for (int idx = mInsertCharList.Count - 1; idx >= 0; idx--)
{
var idxChar = mInsertCharList[idx];
editWidgetContent.RemoveText(idxChar.Item1, 1);
editWidgetContent.RemoveText(idxChar.0, 1);
}
editWidgetContent.ContentChanged();
SetPreviousState(false);
@ -290,12 +290,12 @@ namespace Beefy.widgets
var editWidgetContent = EditWidgetContent;
SetPreviousState(true);
for (var idxChar in mRemoveCharList)
editWidgetContent.RemoveText(idxChar.Item1, 1);
editWidgetContent.RemoveText(idxChar.0, 1);
var charStr = scope String(' ', 1);
for (var idxChar in mInsertCharList)
{
charStr[0] = idxChar.Item2;
editWidgetContent.InsertText(idxChar.Item1, charStr);
charStr[0] = idxChar.1;
editWidgetContent.InsertText(idxChar.0, charStr);
}
editWidgetContent.ContentChanged();
editWidgetContent.mSelection = mNewSelection;
@ -3158,7 +3158,7 @@ namespace Beefy.widgets
char8 c = (char8)mData.mText[lineStart + i].mChar;
if (((c == '\t') && (i == 0)) || (c == ' '))
{
indentTextAction.mRemoveCharList.Add(Tuple<int32, char8>((int32)lineStart + i + endAdjust, c));
indentTextAction.mRemoveCharList.Add(((int32)lineStart + i + endAdjust, c));
//RemoveText(lineStart, 1);
endAdjust--;
}
@ -3181,7 +3181,7 @@ namespace Beefy.widgets
GetLinePosition(lineIdx, out lineStart, out lineEnd);
lineStart += endAdjust;
//InsertText(lineStart, "\t");
indentTextAction.mInsertCharList.Add(Tuple<int32, char8>((int32)lineStart, '\t'));
indentTextAction.mInsertCharList.Add(((int32)lineStart, '\t'));
endAdjust++;
}

View file

@ -1,27 +0,0 @@
namespace System
{
struct Tuple<T1, T2> : IHashable where T1 : IHashable where T2 : IHashable
{
public T1 Item1;
public T2 Item2;
public this()
{
Item1 = default(T1);
Item2 = default(T2);
}
public this(T1 item1, T2 item2)
{
Item1 = item1;
Item2 = item2;
}
public int GetHashCode()
{
int h1 = Item1.GetHashCode();
int h2 = Item2.GetHashCode();
return (((h1 << 5) + h1) ^ h2);
}
}
}