Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 2fb68f2

Browse files
Fixed little delete text problem
1 parent 2f1504f commit 2fb68f2

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

TextControlBox/TextControlBox.xaml.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private void RemoveText(bool ControlIsPressed = false)
358358
if (curLine.Length > 0)
359359
TotalLines.String_AddToEnd(CursorPosition.LineNumber - 1, curLine);
360360

361-
TotalLines.RemoveAt(CursorPosition.LineNumber);
361+
TotalLines.DeleteAt(CursorPosition.LineNumber);
362362

363363
//update the cursorposition
364364
CursorPosition.LineNumber -= 1;
@@ -399,15 +399,9 @@ private void DeleteText(bool ControlIsPressed = false)
399399

400400
undoRedo.RecordUndoAction(() =>
401401
{
402-
int curpos = TotalLines.GetLineLength(CursorPosition.LineNumber - 1);
403-
404-
//line still has text
405-
if (curLine.Length > 0)
406-
TotalLines.String_AddToEnd(CursorPosition.LineNumber, LineToAdd);
407-
else //line has no text
408-
CursorPosition.LineNumber -= 1;
409-
410-
TotalLines.RemoveAt(CursorPosition.LineNumber + 1);
402+
int curpos = TotalLines.GetLineLength(CursorPosition.LineNumber);
403+
CurrentLine += LineToAdd;
404+
TotalLines.DeleteAt(CursorPosition.LineNumber + 1);
411405

412406
//update the cursorposition
413407
CursorPosition.CharacterPosition = curpos;

0 commit comments

Comments
 (0)