1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 05:44:11 +02:00

Fixed some comment/uncomment issues

This commit is contained in:
Brian Fiete 2024-02-01 08:18:25 -05:00
parent d0b187a313
commit c5f58c34ba

View file

@ -2889,7 +2889,7 @@ namespace IDE.ui
InsertAtCursor("*/"); InsertAtCursor("*/");
if (doComment != null) if (doComment != null)
mSelection = EditSelection(firstCharPos, lastCharPos + gApp.mSettings.mEditorSettings.mTabSize); mSelection = EditSelection(firstCharPos, lastCharPos + 4);
} }
if (undoBatchStart != null) if (undoBatchStart != null)
@ -3139,19 +3139,23 @@ namespace IDE.ui
{ {
for (int i = firstCharPos; i <= lastCharPos; i++) for (int i = firstCharPos; i <= lastCharPos; i++)
{ {
if ((minPos == 0 && i == 0) || (minPos>=0 && SafeGetChar(i - 1) == '\n' || SafeGetChar(i - 1) == '\t')) if (((minPos == 0) && (i == 0)) ||
if (SafeGetChar(i - 0) == '/' && SafeGetChar(i + 1) == '/') ((minPos >= 0) && (SafeGetChar(i - 1) == '\n') || (SafeGetChar(i - 1) == '\t') || (SafeGetChar(i - 1) == ' ')))
{ {
mSelection = EditSelection(i - 0, i + 2); if (SafeGetChar(i - 0) == '/' && SafeGetChar(i + 1) == '/')
DeleteSelection();
lastCharPos -= 2;
while (i < maxPos && SafeGetChar(i) != '\n')
{ {
i++; mSelection = EditSelection(i - 0, i + 2);
DeleteSelection();
lastCharPos -= 2;
while (i < maxPos && SafeGetChar(i) != '\n')
{
i++;
}
} }
} }
} }
startLineAndCol = null;
CursorToLineEnd(); CursorToLineEnd();
int cursorEndPos = CursorTextPos; int cursorEndPos = CursorTextPos;
mSelection = .(minPos, cursorEndPos); mSelection = .(minPos, cursorEndPos);
@ -3170,7 +3174,8 @@ namespace IDE.ui
} }
} }
else if (doComment != false) else if (doComment != false)
{ //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
if (doLineComment) if (doLineComment)
{ {
CursorTextPos = minPos; CursorTextPos = minPos;
@ -3205,6 +3210,7 @@ namespace IDE.ui
if (prevSelection == null) if (prevSelection == null)
mSelection = null; mSelection = null;
ClampCursor();
FixSelection(); FixSelection();
return true; return true;