1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Removed multi-line line commenting from ToggleComment

This commit is contained in:
Brian Fiete 2021-12-21 18:11:46 -05:00
parent 8ff8ff0df1
commit a5794d210c

View file

@ -2437,9 +2437,6 @@ namespace IDE.ui
int firstCharPos = minPos + (startLen - afterTrimStart); int firstCharPos = minPos + (startLen - afterTrimStart);
int lastCharPos = maxPos - (afterTrimStart - afterTrimEnd); int lastCharPos = maxPos - (afterTrimStart - afterTrimEnd);
int q = 0;
var nc = trimmedStr.Count('\n');
if (afterTrimEnd == 0) if (afterTrimEnd == 0)
{ {
if (undoBatchStart != null) if (undoBatchStart != null)
@ -2486,10 +2483,8 @@ namespace IDE.ui
mSelection = EditSelection(firstCharPos, lastCharPos - 4); mSelection = EditSelection(firstCharPos, lastCharPos - 4);
} }
} }
else if (doComment != false && minPos >=0 && ((nc <= 1 && (SafeGetChar(minPos-1) != ' ' && SafeGetChar(minPos-1) != '\t') && SafeGetChar(minPos-1) != '\n') else if (doComment != false)
|| nc >= 1 && (SafeGetChar(maxPos-1) != ' ' && SafeGetChar(maxPos-1) != '\t') && SafeGetChar(maxPos-1) != '\n'))
{ //if selection is from beginning of the line then we want to use // comment, that's why the check for line count and ' ' and tab { //if selection is from beginning of the line then we want to use // comment, that's why the check for line count and ' ' and tab
CursorTextPos = firstCharPos;
if (doLineComment) if (doLineComment)
{ {
CursorTextPos = minPos; CursorTextPos = minPos;
@ -2497,6 +2492,7 @@ namespace IDE.ui
} }
else else
{ {
CursorTextPos = firstCharPos;
InsertAtCursor("/*"); InsertAtCursor("/*");
CursorTextPos = lastCharPos + 2; CursorTextPos = lastCharPos + 2;
InsertAtCursor("*/"); InsertAtCursor("*/");
@ -2509,20 +2505,6 @@ namespace IDE.ui
CursorTextPos = startTextPos + 2; CursorTextPos = startTextPos + 2;
startLineAndCol = null; startLineAndCol = null;
} }
else if (doComment != false)
{
for (int i = firstCharPos; i < maxPos + q; i++)
{
CursorTextPos = i; // needed to add i < maxPos + q; for this to work with InsertAtCursor
InsertAtCursor("//"); q++; q++;
while (SafeGetChar(i) != '\n' && i < maxPos + q)
{
i++;
}
}
mSelection = EditSelection(minPos, maxPos + q);
}
else else
{ {
mSelection = prevSelection; mSelection = prevSelection;