mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 02:30:15 +02:00
SynEdit: Make BIDI default / ecDeleteChar fix half tab del
git-svn-id: trunk@39104 -
This commit is contained in:
parent
b48bd1be53
commit
8afb351bd1
@ -1871,12 +1871,12 @@ begin
|
|||||||
FDoubleWidthChrLinesView := SynEditStringDoubleWidthChars.Create
|
FDoubleWidthChrLinesView := SynEditStringDoubleWidthChars.Create
|
||||||
(FTrimmedLinesView);
|
(FTrimmedLinesView);
|
||||||
|
|
||||||
{$IFDEF WithSynBiDi }
|
{$IFnDEF WithOutSynBiDi}
|
||||||
FBidiChrLinesView := TSynEditStringBidiChars.Create(FDoubleWidthChrLinesView);
|
FBidiChrLinesView := TSynEditStringBidiChars.Create(FDoubleWidthChrLinesView);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// ftab, currently has LengthOfLongestLine, therefore must be after DoubleWidthChar
|
// ftab, currently has LengthOfLongestLine, therefore must be after DoubleWidthChar
|
||||||
{$IFDEF WithSynBiDi }
|
{$IFnDEF WithOutSynBiDi }
|
||||||
FTabbedLinesView := TSynEditStringTabExpander.Create(FBidiChrLinesView);
|
FTabbedLinesView := TSynEditStringTabExpander.Create(FBidiChrLinesView);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
FTabbedLinesView := TSynEditStringTabExpander.Create(FDoubleWidthChrLinesView);
|
FTabbedLinesView := TSynEditStringTabExpander.Create(FDoubleWidthChrLinesView);
|
||||||
@ -2343,7 +2343,7 @@ begin
|
|||||||
FreeAndNil(FStrings);
|
FreeAndNil(FStrings);
|
||||||
FreeAndNil(FTabbedLinesView);
|
FreeAndNil(FTabbedLinesView);
|
||||||
FreeAndNil(FTrimmedLinesView); // has reference to caret
|
FreeAndNil(FTrimmedLinesView); // has reference to caret
|
||||||
{$IFDEF WithSynBiDi }
|
{$IFnDEF WithOutSynBiDi}
|
||||||
FreeAndNil(FBidiChrLinesView);
|
FreeAndNil(FBidiChrLinesView);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FreeAndNil(FDoubleWidthChrLinesView);
|
FreeAndNil(FDoubleWidthChrLinesView);
|
||||||
@ -6215,7 +6215,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
Temp := LineText;
|
Temp := LineText;
|
||||||
Len := Length(Temp);
|
Len := Length(Temp);
|
||||||
LogCaretXY:=LogicalCaretXY;
|
LogCaretXY := FCaret.LineBytePos;
|
||||||
Caret := CaretXY;
|
Caret := CaretXY;
|
||||||
//debugln('ecDeleteLastChar B Temp="',DbgStr(Temp),'" CaretX=',dbgs(CaretX),' LogCaretXY=',dbgs(LogCaretXY));
|
//debugln('ecDeleteLastChar B Temp="',DbgStr(Temp),'" CaretX=',dbgs(CaretX),' LogCaretXY=',dbgs(LogCaretXY));
|
||||||
if LogCaretXY.X > Len +1
|
if LogCaretXY.X > Len +1
|
||||||
@ -6239,8 +6239,12 @@ begin
|
|||||||
FTheLinesView.EditDelete(CaretX, LogCaretXY.Y, 1);
|
FTheLinesView.EditDelete(CaretX, LogCaretXY.Y, 1);
|
||||||
{$ELSE USE_UTF8BIDI_LCL}
|
{$ELSE USE_UTF8BIDI_LCL}
|
||||||
LogCounter := LogCaretXY.X;
|
LogCounter := LogCaretXY.X;
|
||||||
LogCaretXY.X := FTheLinesView.LogicPosAddChars(Temp, LogCaretXY.X, -1);
|
if FCaret.BytePosOffset = 0 then begin
|
||||||
LogCounter := LogCounter - LogCaretXY.X;
|
LogCaretXY.X := FTheLinesView.LogicPosAddChars(Temp, LogCaretXY.X, -1);
|
||||||
|
LogCounter := LogCounter - LogCaretXY.X;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
LogCounter := GetCharLen(Temp, LogCaretXY.X);
|
||||||
FTheLinesView.EditDelete(LogCaretXY.X, LogCaretXY.Y, LogCounter);
|
FTheLinesView.EditDelete(LogCaretXY.X, LogCaretXY.Y, LogCounter);
|
||||||
FCaret.BytePos := LogCaretXY.X;
|
FCaret.BytePos := LogCaretXY.X;
|
||||||
{$ENDIF USE_UTF8BIDI_LCL}
|
{$ENDIF USE_UTF8BIDI_LCL}
|
||||||
|
@ -203,6 +203,7 @@ type
|
|||||||
procedure setLinePos(const AValue: Integer);
|
procedure setLinePos(const AValue: Integer);
|
||||||
function GetLineCharPos: TPoint;
|
function GetLineCharPos: TPoint;
|
||||||
procedure SetLineCharPos(AValue: TPoint);
|
procedure SetLineCharPos(AValue: TPoint);
|
||||||
|
function GetBytePosOffset: Integer;
|
||||||
function GetBytePos: Integer;
|
function GetBytePos: Integer;
|
||||||
procedure SetBytePos(const AValue: Integer);
|
procedure SetBytePos(const AValue: Integer);
|
||||||
function GetLineBytePos: TPoint;
|
function GetLineBytePos: TPoint;
|
||||||
@ -243,6 +244,7 @@ type
|
|||||||
property CharPos: Integer read fCharPos write setCharPos;
|
property CharPos: Integer read fCharPos write setCharPos;
|
||||||
property LineCharPos: TPoint read GetLineCharPos write SetLineCharPos;
|
property LineCharPos: TPoint read GetLineCharPos write SetLineCharPos;
|
||||||
property BytePos: Integer read GetBytePos write SetBytePos;
|
property BytePos: Integer read GetBytePos write SetBytePos;
|
||||||
|
property BytePosOffset: Integer read GetBytePosOffset;
|
||||||
property LineBytePos: TPoint read GetLineBytePos write SetLineBytePos;
|
property LineBytePos: TPoint read GetLineBytePos write SetLineBytePos;
|
||||||
property LineText: string read GetLineText write SetLineText;
|
property LineText: string read GetLineText write SetLineText;
|
||||||
|
|
||||||
@ -451,7 +453,7 @@ end;
|
|||||||
procedure TSynEditCaret.IncAutoMoveOnEdit;
|
procedure TSynEditCaret.IncAutoMoveOnEdit;
|
||||||
begin
|
begin
|
||||||
if FAutoMoveOnEdit =0 then
|
if FAutoMoveOnEdit =0 then
|
||||||
UpdateBytePos;;
|
UpdateBytePos;
|
||||||
inc(FAutoMoveOnEdit);
|
inc(FAutoMoveOnEdit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -588,6 +590,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditCaret.GetBytePosOffset: Integer;
|
||||||
|
begin
|
||||||
|
FLines.LogPhysConvertor.PhysicalToLogical(FLinePos-1, FCharPos, Result);
|
||||||
|
// TODO: the below, will interfere with auto-move caret
|
||||||
|
//UpdateBytePos;
|
||||||
|
//Result := FBytePosOffset;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditCaret.UpdateBytePos;
|
procedure TSynEditCaret.UpdateBytePos;
|
||||||
begin
|
begin
|
||||||
FBytePos := FLines.LogPhysConvertor.PhysicalToLogical(FLinePos-1, FCharPos, FBytePosOffset);
|
FBytePos := FLines.LogPhysConvertor.PhysicalToLogical(FLinePos-1, FCharPos, FBytePosOffset);
|
||||||
@ -694,6 +704,9 @@ end;
|
|||||||
function TSynEditCaret.GetLineBytePos: TPoint;
|
function TSynEditCaret.GetLineBytePos: TPoint;
|
||||||
begin
|
begin
|
||||||
Result := FLines.PhysicalToLogicalPos(LineCharPos);
|
Result := FLines.PhysicalToLogicalPos(LineCharPos);
|
||||||
|
// TODO: the below, will interfere with auto-move caret
|
||||||
|
//UpdateBytePos;
|
||||||
|
//Result := Point(FBytePos, FLinePos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditCaret.SetLineBytePos(const AValue: TPoint);
|
procedure TSynEditCaret.SetLineBytePos(const AValue: TPoint);
|
||||||
|
@ -343,7 +343,6 @@ begin
|
|||||||
TestPhysLog('line with double-width/3byte', 7, 4, 4, 1);
|
TestPhysLog('line with double-width/3byte', 7, 4, 4, 1);
|
||||||
TestPhysLog('line with double-width/3byte', 7, 5, 7, 0);
|
TestPhysLog('line with double-width/3byte', 7, 5, 7, 0);
|
||||||
|
|
||||||
{$IFDEF WithSynBiDi }
|
|
||||||
//abc def ghi // 2bytes per char
|
//abc def ghi // 2bytes per char
|
||||||
|
|
||||||
(* Order in String "123" / Order on Screen "321"
|
(* Order in String "123" / Order on Screen "321"
|
||||||
@ -409,7 +408,6 @@ begin
|
|||||||
TestPhysLog('bidi line (mixed arab/latin)',2, 1, 1, 0, 1, 0, 1, 0, 1, 0);
|
TestPhysLog('bidi line (mixed arab/latin)',2, 1, 1, 0, 1, 0, 1, 0, 1, 0);
|
||||||
TestPhysLog('bidi line (mixed arab/latin)',2, 4, 4, 0, 24, 0, 4, 0, 24, 0);
|
TestPhysLog('bidi line (mixed arab/latin)',2, 4, 4, 0, 24, 0, 4, 0, 24, 0);
|
||||||
TestPhysLog('bidi line (mixed arab/latin)',2, 15, 4, 0, 24, 0, 24, 0, 4, 0);
|
TestPhysLog('bidi line (mixed arab/latin)',2, 15, 4, 0, 24, 0, 24, 0, 4, 0);
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestBasicSynEdit.TestCaretAutoMove;
|
procedure TTestBasicSynEdit.TestCaretAutoMove;
|
||||||
|
Loading…
Reference in New Issue
Block a user