From e221096a029195a0356eee8cf59f197fc0d327bd Mon Sep 17 00:00:00 2001 From: Margers Date: Mon, 11 Nov 2024 07:45:52 +0000 Subject: [PATCH] Fix for backspace in empty line. Textmode IDE --- packages/ide/weditor.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ide/weditor.pas b/packages/ide/weditor.pas index 5fdeaa062c..cd8fbd494c 100644 --- a/packages/ide/weditor.pas +++ b/packages/ide/weditor.pas @@ -5064,8 +5064,9 @@ begin CP:=CurPos.X-1; S:=GetLineText(CurPos.Y); CI:=LinePosToCharIdx(CurPos.Y,CP); - if (s[ci]=TAB) {and (CharIdxToLinePos(Curpos.y,ci)=cp)} then - CP:=CharIdxToLinePos(CurPos.Y,CI); + if (ci>0) and (ci<=length(S)) then + if (s[ci]=TAB) {and (CharIdxToLinePos(Curpos.y,ci)=cp)} then + CP:=CharIdxToLinePos(CurPos.Y,CI); if IsFlagSet(efBackspaceUnindents) then begin S:=GetDisplayText(CurPos.Y);