SynEdit: added persistent block

git-svn-id: trunk@20965 -
This commit is contained in:
martin 2009-07-26 23:06:26 +00:00
parent cb577dee7e
commit 592732cea4
13 changed files with 644 additions and 294 deletions

View File

@ -63,10 +63,9 @@ type
Selected: boolean; Index: integer): TPoint of object;
{$ENDIF}
TCodeCompletionEvent = procedure(var Value: string;
{$IFDEF SYN_LAZARUS}
SourceValue: string;
var SourceStart, SourceEnd: TPoint;
KeyChar: TUTF8Char;
{$ENDIF}
Shift: TShiftState) of object;
TValidateEvent = procedure(Sender: TObject;
{$IFDEF SYN_LAZARUS}
@ -1297,18 +1296,13 @@ begin
end;
end;
procedure TSynCompletion.Validate(Sender: TObject;
{$IFDEF SYN_LAZARUS}KeyChar: TUTF8Char;{$ENDIF}
procedure TSynCompletion.Validate(Sender: TObject; KeyChar: TUTF8Char;
Shift: TShiftState);
var
F: TSynBaseCompletionForm;
Value, CurLine: string;
{$IFDEF SYN_LAZARUS}
NewCaretXY, NewBlockBegin: TPoint;
NewBlockBegin, NewBlockEnd: TPoint;
LogCaret: TPoint;
{$Else}
Pos: TPoint;
{$ENDIF}
begin
//debugln('TSynCompletion.Validate ',dbgsName(Sender),' ',dbgs(Shift),' Position=',dbgs(Position));
F := Sender as TSynBaseCompletionForm;
@ -1316,49 +1310,38 @@ begin
if F.CurrentEditor is TCustomSynEdit then
with TCustomSynEdit(F.CurrentEditor) do begin
BeginUndoBlock;
{$IFDEF SYN_LAZARUS}
LogCaret:=PhysicalToLogicalPos(CaretXY);
NewBlockBegin:=LogCaret;
CurLine:=Lines[NewBlockBegin.Y - 1];
while (NewBlockBegin.X>1) and (NewBlockBegin.X-1<=length(CurLine))
and (CurLine[NewBlockBegin.X-1] in ['a'..'z','A'..'Z','0'..'9','_']) do
dec(NewBlockBegin.X);
BlockBegin:=NewBlockBegin;
//BlockBegin:=NewBlockBegin;
if ssShift in Shift then begin
// replace only prefix
BlockEnd := LogCaret;
NewBlockEnd := LogCaret;
end else begin
// replace the whole word
NewCaretXY:=LogCaret;
CurLine:=Lines[NewCaretXY.Y - 1];
while (NewCaretXY.X<=length(CurLine))
and (CurLine[NewCaretXY.X] in ['a'..'z','A'..'Z','0'..'9','_']) do
inc(NewCaretXY.X);
BlockEnd := NewCaretXY;
NewBlockEnd := LogCaret;
CurLine:=Lines[NewBlockEnd.Y - 1];
while (NewBlockEnd.X<=length(CurLine))
and (CurLine[NewBlockEnd.X] in ['a'..'z','A'..'Z','0'..'9','_']) do
inc(NewBlockEnd.X);
end;
{$ELSE}
BlockBegin := Point(CaretX - length(CurrentString), CaretY);
BlockEnd := Point(CaretX, CaretY);
{$ENDIF}
//debugln('TSynCompletion.Validate B Position=',dbgs(Position));
if Position>=0 then begin
if Assigned(FOnCodeCompletion) then
begin
Value := ItemList[Position];
FOnCodeCompletion(Value,{$IFDEF SYN_LAZARUS}SelText, KeyChar{$ENDIF}, Shift);
SelText := Value;
FOnCodeCompletion(Value, TextBetweenPoints[NewBlockBegin, NewBlockEnd],
NewBlockBegin, NewBlockEnd, KeyChar, Shift);
//SelText := Value;
if (CompareCarets(NewBlockBegin, NewBlockEnd) <> 0) or (Value <> '') then
TextBetweenPoints[NewBlockBegin, NewBlockEnd] := Value;
end else
SelText := ItemList[Position];
TextBetweenPoints[NewBlockBegin, NewBlockEnd] := ItemList[Position];
//SelText := ItemList[Position];
end;
{$IFNDEF SYN_LAZARUS}
with Editor do begin
Pos := CaretXY;
Perform(LM_MBUTTONDOWN, 0, 0);
Application.ProcessMessages;
CaretXY := Pos;
end;
SetFocus;
{$ENDIF}
EndUndoBlock;
end;
end;

View File

@ -233,7 +233,8 @@ type
eoCaretSkipsSelection, // Caret skips selection on VK_LEFT/VK_RIGHT
eoAlwaysVisibleCaret, // Move caret to be always visible when scrolling
eoEnhanceEndKey, // end key jumps to visual/hard line end whichever is nearer
eoFoldedCopyPaste // Remember folds in copy/paste operations
eoFoldedCopyPaste, // Remember folds in copy/paste operations
eoPersistentBlock // Keep block if caret moves away or text is edited
);
TSynEditorOptions2 = set of TSynEditorOption2;
@ -454,6 +455,7 @@ type
function GetDefSelectionMode: TSynSelectionMode;
function GetFoldState: String;
function GetPlugin(Index: Integer): TSynEditPlugin;
function GetTextBetweenPoints(aStartPoint, aEndPoint: TPoint): String;
function GetUndoList: TSynEditUndoList;
function GetDividerDrawLevel: Integer; deprecated;
procedure SetDefSelectionMode(const AValue: TSynSelectionMode);
@ -461,6 +463,7 @@ type
procedure SetFoldState(const AValue: String);
procedure SetMouseActions(const AValue: TSynEditMouseActions);
procedure SetMouseSelActions(const AValue: TSynEditMouseActions);
procedure SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint; const AValue: String);
procedure SurrenderPrimarySelection;
procedure BookMarkOptionsChanged(Sender: TObject);
procedure ComputeCaret(X, Y: Integer);
@ -839,6 +842,7 @@ type
{$ENDIF}
procedure WndProc(var Msg: TMessage); override;
public
procedure InsertTextAtCaret(aText: String);
property BlockBegin: TPoint read GetBlockBegin write SetBlockBegin;
property BlockEnd: TPoint read GetBlockEnd write SetBlockEnd;
property FoldState: String read GetFoldState write SetFoldState;
@ -875,6 +879,9 @@ type
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default FALSE;
property SelAvail: Boolean read GetSelAvail;
property SelText: string read GetSelText write SetSelTextExternal;
// Logical Points
property TextBetweenPoints[aStartPoint, aEndPoint: TPoint]: String
read GetTextBetweenPoints write SetTextBetweenPoints;
property TopLine: Integer read fTopLine write SetTopLine;
{$IFDEF SYN_LAZARUS}
property UseUTF8: boolean read FUseUTF8;
@ -1336,6 +1343,14 @@ begin
Result := TSynEditPlugin(fPlugins[Index]);
end;
function TCustomSynEdit.GetTextBetweenPoints(aStartPoint, aEndPoint: TPoint): String;
begin
FInternalBlockSelection.SelectionMode := smNormal;
FInternalBlockSelection.StartLineBytePos := aStartPoint;
FInternalBlockSelection.EndLineBytePos := aEndPoint;
Result := FInternalBlockSelection.SelText;
end;
function TCustomSynEdit.GetDividerDrawLevel: Integer;
begin
Result := fHighlighter.DrawDividerLevel;
@ -2353,12 +2368,8 @@ begin
emcNone: ; // do nothing, but result := true
emcStartSelections, emcStartColumnSelections, emcStartLineSelections:
begin
if AnAction.Option = emcoSelectionContinue then
FBlockSelection.EndLineBytePos := AnInfo.NewCaret.LineBytePos
else begin
MoveCaret;
FBlockSelection.StartLineBytePos := AnInfo.NewCaret.LineBytePos;
end;
FBlockSelection.AutoExtend := AnAction.Option = emcoSelectionContinue;
MoveCaret;
case ACommand of
emcStartColumnSelections:
FBlockSelection.ActiveSelectionMode := smColumn;
@ -2411,7 +2422,6 @@ begin
ClipHelper.ReadFromClipboard(PrimarySelection);
if ClipHelper.TextP <> nil then begin
MoveCaret;
FBlockSelection.StartLineBytePos := FCaret.LineBytePos;
Result := PasteFromClipboardEx(ClipHelper);
end
else
@ -3692,10 +3702,10 @@ begin
try
if ClipHelper.TextP = nil then
exit;
if SelAvail then
FBlockSelection.SelText := '';
Result := True;
if SelAvail and not FBlockSelection.Persistent then
FBlockSelection.SelText := '';
InsStart := FCaret.LineBytePos;
FInternalBlockSelection.StartLineBytePos := InsStart;
FInternalBlockSelection.SetSelTextPrimitive(ClipHelper.SelectionMode, ClipHelper.TextP);
@ -3724,13 +3734,7 @@ begin
Inc(LastPt.x, Length(FTheLinesView[LastPt.y - 1]))
else
LastPt.y := 1;
SetCaretAndSelection(
{$IFDEF SYN_LAZARUS}
LogicalToPhysicalPos(LastPt),
{$ELSE}
LastPt,
{$ENDIF}
Point(1, 1), LastPt);
SetCaretAndSelection(LogicalToPhysicalPos(LastPt), Point(1, 1), LastPt);
end;
{$IFDEF SYN_LAZARUS}
@ -3949,9 +3953,6 @@ begin
BeginUndoBlock;
try
FBlockSelection.SelText := Value;
// Force caret reset
CaretXY := CaretXY;
EnsureCursorPosVisible;
finally
EndUndoBlock;
end;
@ -4825,6 +4826,21 @@ begin
FMouseSelActions.Assign(AValue);
end;
procedure TCustomSynEdit.SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint;
const AValue: String);
begin
BeginUndoBlock;
try
FInternalBlockSelection.SelectionMode := smNormal;
FInternalBlockSelection.StartLineBytePos := aStartPoint;
FInternalBlockSelection.EndLineBytePos := aEndPoint;
FInternalBlockSelection.SelText := AValue;
FCaret.LineBytePos := FInternalBlockSelection.StartLineBytePos;
finally
EndUndoBlock;
end;
end;
function TCustomSynEdit.GetLineState(ALine: Integer): TSynLineState;
begin
with TSynEditStringList(fLines) do
@ -4939,6 +4955,11 @@ begin
inherited;
end;
procedure TCustomSynEdit.InsertTextAtCaret(aText: String);
begin
TextBetweenPoints[FCaret.LineBytePos, FCaret.LineBytePos] := aText;
end;
procedure TCustomSynEdit.DragOver(Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
@ -5570,7 +5591,7 @@ begin
{begin} //mh 2000-10-30
ecDeleteLastChar:
if not ReadOnly then begin
if SelAvail then
if SelAvail and not FBlockSelection.Persistent then
SetSelTextExternal('')
else begin
Temp := LineText;
@ -5610,7 +5631,7 @@ begin
end;
ecDeleteChar:
if not ReadOnly then begin
if SelAvail then
if SelAvail and not FBlockSelection.Persistent then
SetSelTextExternal('')
else begin
Temp := LineText;
@ -5670,8 +5691,6 @@ begin
ecDeleteLine:
if not ReadOnly and not ((FTheLinesView.Count = 1) and (Length(FTheLinesView[0]) = 0))
then begin
if SelAvail then
SetBlockBegin(PhysicalToLogicalPos(CaretXY));
if FTheLinesView.Count = 1 then
FTheLinesView.EditDelete(1, 1, length(FTheLinesView[0]))
else begin
@ -5688,7 +5707,7 @@ begin
if not ReadOnly then begin
if FTheLinesView.Count = 0 then
FTheLinesView.Add('');
if SelAvail then begin
if SelAvail and not FBlockSelection.Persistent then begin
SetSelTextExternal('');
end;
Temp := LineText;
@ -5720,7 +5739,7 @@ begin
FindMatchingBracket;
ecChar:
if not ReadOnly and (AChar >= #32) and (AChar <> #127) then begin
if SelAvail then begin
if SelAvail and not FBlockSelection.Persistent then begin
SetSelTextExternal(AChar);
end else begin
try
@ -5768,7 +5787,7 @@ begin
// Insert a linebreak, but do not apply any other functionality (such as indent)
if FTheLinesView.Count = 0 then
FTheLinesView.Add('');
if SelAvail then
if SelAvail and not FBlockSelection.Persistent then
SetSelTextExternal('');
LogCaretXY:=PhysicalToLogicalPos(CaretXY);
FTheLinesView.EditLineBreak(LogCaretXY.X, LogCaretXY.Y);
@ -5856,6 +5875,61 @@ begin
begin
InsertMode := not InsertMode;
end;
ecBlockSetBegin:
begin
FBlockSelection.Hide :=
CompareCarets(FCaret.LineBytePos, FBlockSelection.EndLineBytePos) <= 0;
FBlockSelection.StartLineBytePosAdjusted := FCaret.LineBytePos;
end;
ecBlockSetEnd:
begin
FBlockSelection.Hide :=
CompareCarets(FCaret.LineBytePos, FBlockSelection.StartLineBytePos) >= 0;
FBlockSelection.EndLineBytePos := FCaret.LineBytePos;
end;
ecBlockToggleHide:
begin
FBlockSelection.Hide := not FBlockSelection.Hide;
end;
ecBlockHide:
begin
FBlockSelection.Hide := True;
end;
ecBlockShow:
begin
FBlockSelection.Hide := False;
end;
ecBlockMove:
begin
if SelAvail then begin
FInternalBlockSelection.AssignFrom(FBlockSelection);
FBlockSelection.StartLineBytePos := FCaret.LineBytePos;
InsertTextAtCaret(FBlockSelection.SelText);
FBlockSelection.EndLineBytePos := FCaret.LineBytePos;
FInternalBlockSelection.SelText := '';
end;
end;
ecBlockCopy:
begin
if SelAvail then
InsertTextAtCaret(FBlockSelection.SelText);
end;
ecBlockDelete:
begin
if SelAvail then
FBlockSelection.SelText := '';
end;
ecBlockGotoBegin:
begin
if SelAvail then
FCaret.LineBytePos := FBlockSelection.FirstLineBytePos;
end;
ecBlockGotoEnd:
begin
if SelAvail then
FCaret.LineBytePos := FBlockSelection.LastLineBytePos;
end;
ecBlockIndent:
if not ReadOnly then DoBlockIndent;
ecBlockUnindent:
@ -6729,11 +6803,16 @@ end;
{$IFDEF SYN_LAZARUS}
procedure TCustomSynEdit.SetOptions2(const Value: TSynEditorOptions2);
var
ChangedOptions: TSynEditorOptions2;
begin
if (Value <> fOptions2) then begin
ChangedOptions:=(fOptions2 - Value) + (Value - fOptions2);
fOptions2 := Value;
if eoAlwaysVisibleCaret in fOptions2 then
MoveCaretToVisibleArea;
if eoPersistentBlock in ChangedOptions then
FBlockSelection.Persistent := eoPersistentBlock in fOptions2;
end;
end;
{$ENDIF}

View File

@ -163,6 +163,18 @@ const
ecColumnSelect = 232; // Column selection mode
ecLineSelect = 233; // Line selection mode
// Persistent Block
ecBlockSetBegin = 235;
ecBlockSetEnd = 236;
ecBlockToggleHide = 237;
ecBlockHide = 238;
ecBlockShow = 239;
ecBlockMove = 240;
ecBlockCopy = 241;
ecBlockDelete = 242;
ecBlockGotoBegin = 243;
ecBlockGotoEnd = 244;
ecMatchBracket = 250; // Go to matching bracket
ecGotoMarker0 = 301; // Goto marker
@ -465,7 +477,7 @@ type
{$ENDIF}
const
EditorCommandStrs: array[0..128] of TIdentMapEntry = (
EditorCommandStrs: array[0..138] of TIdentMapEntry = (
(Value: ecNone; Name: 'ecNone'),
(Value: ecLeft; Name: 'ecLeft'),
(Value: ecRight; Name: 'ecRight'),
@ -550,6 +562,16 @@ const
(Value: ecNormalSelect; Name: 'ecNormalSelect'),
(Value: ecColumnSelect; Name: 'ecColumnSelect'),
(Value: ecLineSelect; Name: 'ecLineSelect'),
(Value: ecBlockSetBegin; Name: 'ecBlockSetBegin'),
(Value: ecBlockSetEnd; Name: 'ecBlockSetEnd'),
(Value: ecBlockToggleHide; Name: 'ecBlockToggleHide'),
(Value: ecBlockHide; Name: 'ecBlockHide'),
(Value: ecBlockShow; Name: 'ecBlockShow'),
(Value: ecBlockMove; Name: 'ecBlockMove'),
(Value: ecBlockCopy; Name: 'ecBlockCopy'),
(Value: ecBlockDelete; Name: 'ecBlockDelete'),
(Value: ecBlockGotoBegin; Name: 'ecBlockGotoBegin'),
(Value: ecBlockGotoEnd; Name: 'ecBlockGotoEnd'),
(Value: ecAutoCompletion; Name: 'ecAutoCompletion'),
(Value: ecUserFirst; Name: 'ecUserFirst'),
(Value: ecGotoMarker0; Name: 'ecGotoMarker0'),

View File

@ -73,6 +73,7 @@ type
private
FAutoExtend: Boolean;
FCaret: TSynEditCaret;
FHide: Boolean;
FInternalCaret: TSynEditCaret;
fUndoList: TSynEditUndoList;
FInvalidateLinesMethod: TInvalidateLines;
@ -87,12 +88,19 @@ type
FEndBytePos: Integer; // 1 based
FPersistent: Boolean;
FPersistentLock: Integer;
(* On any modification, remember the position of the caret.
If it gets moved from there to either end of the block, this should be ignored
This happens, if Block and caret are adjusted directly
*)
FLastCarePos: TPoint;
function AdjustBytePosToCharacterStart(Line: integer; BytePos: integer): integer;
function GetFirstLineBytePos: TPoint;
function GetLastLineBytePos: TPoint;
procedure SetCaret(const AValue: TSynEditCaret);
procedure SetEnabled(const Value : Boolean);
procedure SetActiveSelectionMode(const Value: TSynSelectionMode);
procedure SetHide(const AValue: Boolean);
procedure SetPersistent(const AValue: Boolean);
procedure SetSelectionMode (const AValue: TSynSelectionMode);
function GetStartLineBytePos: TPoint;
procedure SetStartLineBytePos(Value: TPoint);
@ -110,12 +118,15 @@ type
public
constructor Create(ALines: TSynEditStrings; aActOnLineChanges: Boolean);
destructor Destroy; override;
procedure AssignFrom(Src: TSynEditSelection);
procedure SetSelTextPrimitive(PasteMode: TSynSelectionMode; Value: PChar);
function SelAvail: Boolean;
function SelCanContinue(ACaret: TSynEditCaret): Boolean;
function IsBackwardSel: Boolean; // SelStart < SelEnd ?
procedure SortSelectionPoints;
procedure IncPersistentLock;
procedure DecPersistentLock;
procedure Clear;
property Enabled: Boolean read FEnabled write SetEnabled;
property ActiveSelectionMode: TSynSelectionMode
read FActiveSelectionMode write SetActiveSelectionMode;
@ -126,6 +137,8 @@ type
// This may mean Startpos is behind EndPos in the text
property StartLineBytePos: TPoint
read GetStartLineBytePos write SetStartLineBytePos;
property StartLineBytePosAdjusted: TPoint
write AdjustStartLineBytePos;
property EndLineBytePos: TPoint
read GetEndLineBytePos write SetEndLineBytePos;
property StartLinePos: Integer read FStartLinePos;
@ -138,10 +151,11 @@ type
property InvalidateLinesMethod : TInvalidateLines write FInvalidateLinesMethod;
property Caret: TSynEditCaret read FCaret write SetCaret;
property UndoList: TSynEditUndoList read fUndoList write fUndoList;
property Persistent: Boolean read FPersistent write FPersistent;
property Persistent: Boolean read FPersistent write SetPersistent;
// automatically Start/Exctend selection if caret moves
// (depends if caret was at block border or not)
property AutoExtend: Boolean read FAutoExtend write FAutoExtend;
property Hide: Boolean read FHide write SetHide;
end;
{ TSynEditCaret }
@ -480,6 +494,9 @@ procedure TSynEditCaret.DoUnlock;
begin
if (FOldCharPos <> FCharPos) or (FOldLinePos <> FLinePos) then
fOnChangeList.CallNotifyEvents(self);
// All notifications called, reset oldpos
FOldCharPos := FCharPos;
FOldLinePos := FLinePos;
end;
{ TSynEditSelection }
@ -514,6 +531,19 @@ begin
inherited Destroy;
end;
procedure TSynEditSelection.AssignFrom(Src: TSynEditSelection);
begin
//FEnabled := src.FEnabled;
FHide := src.FHide;
FActiveSelectionMode := src.FActiveSelectionMode;
FSelectionMode := src.FSelectionMode;
FStartLinePos := src.FStartLinePos; // 1 based
FStartBytePos := src.FStartBytePos; // 1 based
FEndLinePos := src.FEndLinePos; // 1 based
FEndBytePos := src.FEndBytePos; // 1 based
FPersistent := src.FPersistent;
end;
procedure TSynEditSelection.AdjustAfterTrimming;
begin
if FStartBytePos > Length(FLines[FStartLinePos-1]) + 1 then
@ -705,27 +735,37 @@ end;
procedure TSynEditSelection.DoCaretChanged(Sender: TObject);
begin
if FCaret.IsAtLineByte(StartLineBytePos) or
FCaret.IsAtLineByte(EndLineBytePos)
if (FCaret.IsAtLineByte(StartLineBytePos) or
FCaret.IsAtLineByte(EndLineBytePos)) and
FCaret.WasAtLineChar(FLastCarePos)
then
exit;
FLastCarePos := Point(-1, -1);
if FAutoExtend then begin
if (FCaret.WasAtLineByte(EndLineBytePos)) then
if (not FHide) and (FCaret.WasAtLineByte(EndLineBytePos)) then
SetEndLineBytePos(FCaret.LineBytePos)
else
if (FCaret.WasAtLineByte(StartLineBytePos)) then
if (not FHide) and (FCaret.WasAtLineByte(StartLineBytePos)) then
AdjustStartLineBytePos(FCaret.LineBytePos)
else begin
StartLineBytePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
EndLineBytePos := FCaret.LineBytePos;
if Persistent and IsBackwardSel then
SortSelectionPoints;
end;
exit;
end;
if FPersistent or (FPersistentLock > 0) then
exit;
if FCaret.IsAtLineByte(StartLineBytePos) or
FCaret.IsAtLineByte(EndLineBytePos)
then
exit;
StartLineBytePos := FCaret.LineBytePos;
end;
@ -752,9 +792,11 @@ procedure TSynEditSelection.DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBy
else
if aLineBrkCnt > 0 then begin
(* Lines Inserted *)
if aPoint.y >= aLinePos then begin
if (aPoint.y = aLinePos) and (aPoint.x > aBytePos) then
Result.x := Result.x - aBytePos + 1;
if (aPoint.y = aLinePos) and (aPoint.x >= aBytePos) then begin
Result.x := Result.x - aBytePos + 1;
Result.y := Result.y + aLineBrkCnt;
end;
if aPoint.y > aLinePos then begin
Result.y := Result.y + aLineBrkCnt;
end;
end
@ -769,8 +811,10 @@ procedure TSynEditSelection.DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBy
begin
if FIsSettingText then exit;
if FPersistent or (FPersistentLock > 0) then begin
AdjustStartLineBytePos(AdjustPoint(StartLineBytePos));
EndLineBytePos := AdjustPoint(EndLineBytePos);
if FActiveSelectionMode <> smColumn then begin
AdjustStartLineBytePos(AdjustPoint(StartLineBytePos));
EndLineBytePos := AdjustPoint(EndLineBytePos);
end;
end
else
if (FCaret <> nil) then
@ -1009,7 +1053,14 @@ begin
if FActiveSelectionMode = smLine then
BB.X := 1;
StartLineBytePos := BB; // deletes selection // calls selection changed
end;
// Need to update caret (syncro edit follows on every edit)
if FCaret <> nil then
FCaret.LineCharPos := FInternalCaret.LineCharPos;
end
else
if FCaret <> nil then
StartLineBytePos := FCaret.LineBytePos;
FInternalCaret.LineBytePos := StartLineBytePos;
if (Value <> nil) and (Value[0] <> #0) then begin
InsertText;
@ -1067,10 +1118,13 @@ begin
(FEndBytePos <> Value.X) or (FEndLinePos <> Value.Y);
end;
FActiveSelectionMode := FSelectionMode;
FHide := False;
FStartLinePos := Value.Y;
FStartBytePos := Value.X;
FEndLinePos := Value.Y;
FEndBytePos := Value.X;
if FCaret <> nil then
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
if SelChanged then
fOnChangeList.CallNotifyEvents(self);
end;
@ -1098,6 +1152,8 @@ begin
FInvalidateLinesMethod(FStartLinePos, Value.Y);
FStartLinePos := Value.Y;
FStartBytePos := Value.X;
if FCaret <> nil then
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
FOnChangeList.CallNotifyEvents(self);
end;
end;
@ -1143,6 +1199,8 @@ begin
FInvalidateLinesMethod(FEndLinePos, Value.Y);
FEndLinePos := Value.Y;
FEndBytePos := Value.X;
if FCaret <> nil then
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
FOnChangeList.CallNotifyEvents(self);
end;
end;
@ -1166,6 +1224,25 @@ begin
end;
end;
procedure TSynEditSelection.SetHide(const AValue: Boolean);
begin
if FHide = AValue then exit;
FHide := AValue;
FInvalidateLinesMethod(Min(FStartLinePos, FEndLinePos),
Max(FStartLinePos, FEndLinePos) );
end;
procedure TSynEditSelection.SetPersistent(const AValue: Boolean);
begin
if FPersistent = AValue then exit;
FPersistent := AValue;
if (not FPersistent) and (FCaret <> nil) and
not ( FCaret.IsAtLineByte(StartLineBytePos) or
FCaret.IsAtLineByte(EndLineBytePos) )
then
Clear;
end;
// Only needed if the Selection is set from External
function TSynEditSelection.AdjustBytePosToCharacterStart(Line : integer; BytePos : integer) : integer;
var
@ -1210,15 +1287,17 @@ end;
function TSynEditSelection.SelAvail : Boolean;
begin
Result := (FStartBytePos <> FEndBytePos) or
((FStartLinePos <> FEndLinePos) and (FActiveSelectionMode <> smColumn));
Result := (not FHide) and
( (FStartBytePos <> FEndBytePos) or
((FStartLinePos <> FEndLinePos) and (FActiveSelectionMode <> smColumn)) );
end;
function TSynEditSelection.SelCanContinue(ACaret: TSynEditCaret): Boolean;
begin
if SelAvail then exit(True);
Result := (FActiveSelectionMode = smColumn) and (FEndLinePos = ACaret.LinePos)
and (FEndBytePos = ACaret.BytePos);
Result := (not FHide) and
(FActiveSelectionMode = smColumn) and (FEndLinePos = ACaret.LinePos) and
(FEndBytePos = ACaret.BytePos);
end;
function TSynEditSelection.IsBackwardSel: Boolean;
@ -1227,6 +1306,14 @@ begin
or ((FStartLinePos = FEndLinePos) and (FStartBytePos > FEndBytePos));
end;
procedure TSynEditSelection.SortSelectionPoints;
begin
if IsBackwardSel then begin
SwapInt(FStartLinePos, FEndLinePos);
SwapInt(FStartBytePos, FEndBytePos);
end;
end;
procedure TSynEditSelection.IncPersistentLock;
begin
inc(FPersistentLock)
@ -1237,5 +1324,13 @@ begin
dec(FPersistentLock)
end;
procedure TSynEditSelection.Clear;
begin
if Caret <> nil then
StartLineBytePos := Caret.LineBytePos
else
StartLineBytePos := StartLineBytePos;
end;
end.

View File

@ -182,7 +182,7 @@ type
procedure ResetDefaults; override;
end;
TSynPluginSyncroEditModes = (spseIncative, spseSelecting, spseEditing);
TSynPluginSyncroEditModes = (spseIncative, spseSelecting, spseEditing, spseInvalid);
{ TSynPluginSyncroEdit }
TSynPluginSyncroEdit = class(TSynPluginCustomSyncroEdit)
@ -215,6 +215,7 @@ type
procedure DoSelectionChanged(Sender: TObject);
procedure DoScanSelection(Data: PtrInt);
procedure DoOnDeactivate; override;
procedure DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean); override;
function MaybeHandleMouseAction(var AnInfo: TSynEditMouseActionInfo;
HandleActionProc: TSynEditMouseActionHandler): Boolean;
@ -313,11 +314,16 @@ end;
function TSynPluginSyncroEditLowerLineCache.GetLowLine(aIndex: Integer): String;
var
i, l: Integer;
begin
l := length(FLower);
for i := 0 to l-1 do
if FLower[i].LineIndex = aIndex then
exit(FLower[i].LineText);
Result := UTF8LowerCase(FLines[aIndex]);
if Result = '' then
exit;
if l < MAX_CACHE then begin
inc(l);
SetLength(FLower, l);
@ -327,8 +333,7 @@ begin
FLower[i].LineText := FLower[i-1].LineText;
end;
FLower[0].LineIndex := aIndex;
FLower[0].LineText := UTF8LowerCase(FLines[aIndex]);
Result := FLower[0].LineText;
FLower[0].LineText := Result;
end;
procedure TSynPluginSyncroEditLowerLineCache.SetLines(const AValue: TSynEditStrings);
@ -1064,14 +1069,19 @@ begin
FWordIndex.Clear;
Editor.Invalidate;
Active := False;
MarkupEnabled := False;
end;
FMode := spseIncative;
exit;
end;
if FMode = spseInvalid then exit;
if FMode = spseIncative then begin
Cells.Clear;
AreaMarkupEnabled := False;
MarkupEnabled := False;
Active := True;
end;
FMode := spseSelecting;
Markup.GlyphAtLine := -1;
@ -1134,8 +1144,8 @@ begin
end;
if (NewPos = NewEnd) or (not InitParsedPoints) then begin
if Active then Editor.Invalidate;
Active := False;
if MarkupEnabled then Editor.Invalidate;
MarkupEnabled := False;
exit;
end;
@ -1162,7 +1172,7 @@ begin
FLastSelEnd := FParsedStop;
end;
Active := FWordIndex.MultiWordCount > 0;
MarkupEnabled := FWordIndex.MultiWordCount > 0;
//debugln(['COUNTS: ', FWordIndex.WordCount,' mult=',FWordIndex.MultiWordCount, ' hash=',FWordIndex.EntryCount]);
if FWordScanCount > MAX_WORDS_PER_SCAN then begin
@ -1184,6 +1194,19 @@ begin
inherited DoOnDeactivate;
end;
procedure TSynPluginSyncroEdit.DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean);
begin
if (FMode = spseSelecting) then begin
inherited DoBeforeEdit(aX, aY, aUndoRedo);
FWordIndex.Clear;
Editor.Invalidate;
Active := False;
FMode := spseInvalid;
end
else
inherited DoBeforeEdit(aX, aY, aUndoRedo);
end;
function TSynPluginSyncroEdit.MaybeHandleMouseAction(var AnInfo: TSynEditMouseActionInfo;
HandleActionProc: TSynEditMouseActionHandler): Boolean;
var

View File

@ -142,6 +142,7 @@ type
FCells: TSynPluginSyncronizedEditList;
FCurrentCell: Integer;
FAreaMarkupEnabled: Boolean;
FMarkupEnabled: Boolean;
FEnabled: Boolean;
FEditing: Boolean;
@ -155,6 +156,7 @@ type
procedure SetCurrentCell(const AValue: Integer);
procedure SetAreaMarkupEnabled(const AValue: Boolean);
procedure SetEnabled(const AValue: Boolean);
procedure SetMarkupEnabled(const AValue: Boolean);
protected
FMarkup: TSynPluginSyncronizedEditMarkup;
FMarkupArea: TSynPluginSyncronizedEditMarkupArea;
@ -163,8 +165,8 @@ type
procedure SetEditor(const AValue: TCustomSynEdit); override;
procedure DoLinesEdited(Sender: TSynEditStrings; aLinePos, aBytePos, aCount,
aLineBrkCnt: Integer; aText: String);
procedure DoBeforeEdit(aX, aY: Integer); virtual;
procedure DoAfterEdit(aX, aY: Integer); virtual;
procedure DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean); virtual;
procedure DoAfterEdit(aX, aY: Integer; aUndoRedo: Boolean); virtual;
procedure DoClear; virtual;
procedure DoOnActivate; virtual;
procedure DoOnDeactivate; virtual;
@ -173,6 +175,7 @@ type
property Markup: TSynPluginSyncronizedEditMarkup read FMarkup;
property MarkupArea: TSynPluginSyncronizedEditMarkupArea read FMarkupArea;
property AreaMarkupEnabled: Boolean read FAreaMarkupEnabled write SetAreaMarkupEnabled;
property MarkupEnabled: Boolean read FMarkupEnabled write SetMarkupEnabled;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -200,7 +203,7 @@ type
procedure SetEditor(const AValue: TCustomSynEdit); override;
procedure DoOnActivate; override;
procedure DoOnDeactivate; override;
procedure DoBeforeEdit(aX, aY: Integer); override;
procedure DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean); override;
procedure UpdateCurrentCell;
procedure DoCaretChanged(Sender: TObject);
property LastCell: Integer read FLastCell;
@ -623,6 +626,7 @@ begin
FCells := TSynPluginSyncronizedEditList.Create;
CurrentCell := -1;
AreaMarkupEnabled := False;
MarkupEnabled := True;
inherited Create(AOwner);
FEnabled := True;
Active := False;
@ -704,7 +708,7 @@ begin
IsActive := Active;
FEnabled := AValue;
if FMarkup <> nil then
FMarkup.Enabled := Active;
FMarkup.Enabled := Active and FMarkupEnabled;
if FMarkupArea <> nil then
FMarkupArea.Enabled := Active and FAreaMarkupEnabled;
if IsActive <> Active then begin
@ -714,6 +718,14 @@ begin
end;
end;
procedure TSynPluginSyncronizedEditBase.SetMarkupEnabled(const AValue: Boolean);
begin
if FMarkupEnabled = AValue then exit;
FMarkupEnabled := AValue;
if FMarkup <> nil then
FMarkup.Enabled := Active and FMarkupEnabled;
end;
procedure TSynPluginSyncronizedEditBase.MarkupChanged(AMarkup: TObject);
begin
if FMarkup <> nil then begin
@ -742,7 +754,7 @@ begin
IsActive := Active;
FActive := AValue;
if FMarkup <> nil then
FMarkup.Enabled := Active;
FMarkup.Enabled := Active and FMarkupEnabled;
if FMarkupArea <> nil then
FMarkupArea.Enabled := Active and FAreaMarkupEnabled;
if IsActive <> Active then begin
@ -794,11 +806,11 @@ var
edit: Boolean;
CaretPos: TPoint;
begin
if (not Active) or (FCells.Count = 0) then exit;
if not Active then exit;
Pos := Point(aBytePos, aLinePos);
Pos2 := Pos;
if (not (FEditing or IsUndoing or IsRedoing)) then
DoBeforeEdit(Pos.x, Pos.y);
if not FEditing then
DoBeforeEdit(Pos.x, Pos.y, IsUndoing or IsRedoing);
// Todo: need do add undo info (start/stop flag),
// so we know which group (if any) this applies to
@ -895,16 +907,16 @@ begin
Pos2.y := Pos.y + CurCell.LogStart.y;
end;
if (not (FEditing or IsUndoing or IsRedoing)) then
DoAfterEdit(Pos2.x, Pos2.y);
if not FEditing then
DoAfterEdit(Pos2.x, Pos2.y, IsUndoing or IsRedoing);
end;
procedure TSynPluginSyncronizedEditBase.DoBeforeEdit(aX, aY: Integer);
procedure TSynPluginSyncronizedEditBase.DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean);
begin
(* Do Nothing *);
end;
procedure TSynPluginSyncronizedEditBase.DoAfterEdit(aX, aY: Integer);
procedure TSynPluginSyncronizedEditBase.DoAfterEdit(aX, aY: Integer; aUndoRedo: Boolean);
begin
(* Do Nothing *);
end;
@ -976,9 +988,10 @@ begin
end;
end;
procedure TSynPluginCustomSyncroEdit.DoBeforeEdit(aX, aY: Integer);
procedure TSynPluginCustomSyncroEdit.DoBeforeEdit(aX, aY: Integer; aUndoRedo: Boolean);
begin
if not Active then exit;
inherited;
if aUndoRedo or not Active then exit;
UpdateCurrentCell;
if CurrentCell < 0 then begin
Clear;

View File

@ -2130,6 +2130,8 @@ begin
SynEditOptName := 'EnhanceEndKey';
eoFoldedCopyPaste:
SynEditOptName := 'FoldedCopyPaste';
eoPersistentBlock:
SynEditOptName := 'PersistentBlock';
else
SynEditOptName := '';
end;
@ -2394,6 +2396,8 @@ begin
SynEditOptName := 'EnhanceEndKey';
eoFoldedCopyPaste:
SynEditOptName := 'FoldedCopyPaste';
eoPersistentBlock:
SynEditOptName := 'PersistentBlock';
else
SynEditOptName := '';
end;

View File

@ -268,7 +268,49 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
Width = 60
Anchors = [akTop, akLeft, akRight]
end
object BlockIndentComboBox: TComboBox[19]
object Bevel6a: TBevel[19]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = BlockGroupLabel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Bevel1a
AnchorSideRight.Side = asrBottom
Left = 0
Height = 3
Top = 402
Width = 60
Anchors = [akTop, akLeft, akRight]
end
object BlockGroupLabel: TLabel[20]
AnchorSideLeft.Control = Bevel5a
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ScrollPastEndLineCheckBox
AnchorSideTop.Side = asrBottom
Left = 70
Height = 16
Top = 395
Width = 96
BorderSpacing.Left = 10
BorderSpacing.Top = 6
Caption = 'BlockGroupLabel'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object Bevel6: TBevel[21]
AnchorSideLeft.Control = CursorGroupLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BlockGroupLabel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 181
Height = 3
Top = 402
Width = 278
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10
end
object BlockIndentComboBox: TComboBox[22]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TabIndentBlocksCheckBox
AnchorSideTop.Side = asrBottom
@ -291,7 +333,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnKeyDown = ComboboxOnKeyDown
TabOrder = 0
end
object TabWidthsComboBox: TComboBox[20]
object TabWidthsComboBox: TComboBox[23]
AnchorSideLeft.Control = SmartTabsCheckBox
AnchorSideTop.Control = BlockIndentComboBox
AnchorSideBottom.Control = Owner
@ -312,7 +354,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnKeyDown = ComboboxOnKeyDown
TabOrder = 1
end
object UndoLimitComboBox: TComboBox[21]
object UndoLimitComboBox: TComboBox[24]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UndoGroupLabel
AnchorSideTop.Side = asrBottom
@ -333,7 +375,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnKeyDown = ComboboxOnKeyDown
TabOrder = 2
end
object GroupUndoCheckBox: TCheckBox[22]
object GroupUndoCheckBox: TCheckBox[25]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UndoAfterSaveCheckBox
AnchorSideTop.Side = asrBottom
@ -346,7 +388,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = GroupUndoCheckBoxChange
TabOrder = 3
end
object UndoAfterSaveCheckBox: TCheckBox[23]
object UndoAfterSaveCheckBox: TCheckBox[26]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UndoGroupLabel
AnchorSideTop.Side = asrBottom
@ -359,7 +401,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
Caption = 'UndoAfterSaveCheckBox'
TabOrder = 4
end
object ScrollPastEndFileCheckBox: TCheckBox[24]
object ScrollPastEndFileCheckBox: TCheckBox[27]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ScrollGroupLabel
AnchorSideTop.Side = asrBottom
@ -373,7 +415,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = ScrollPastEndFileCheckBoxChange
TabOrder = 5
end
object ScrollPastEndLineCheckBox: TCheckBox[25]
object ScrollPastEndLineCheckBox: TCheckBox[28]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = AlwaysVisibleCursorCheckBox
AnchorSideTop.Side = asrBottom
@ -386,7 +428,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = ScrollPastEndLineCheckBoxChange
TabOrder = 6
end
object ScrollByOneLessCheckBox: TCheckBox[26]
object ScrollByOneLessCheckBox: TCheckBox[29]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ScrollGroupLabel
AnchorSideTop.Side = asrBottom
@ -400,7 +442,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = ScrollByOneLessCheckBoxChange
TabOrder = 7
end
object HalfPageScrollCheckBox: TCheckBox[27]
object HalfPageScrollCheckBox: TCheckBox[30]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ScrollPastEndFileCheckBox
AnchorSideTop.Side = asrBottom
@ -413,7 +455,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = HalfPageScrollCheckBoxChange
TabOrder = 8
end
object AutoIndentCheckBox: TCheckBox[28]
object AutoIndentCheckBox: TCheckBox[31]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = IndentsTabsGroupLabel
AnchorSideTop.Side = asrBottom
@ -427,7 +469,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = AutoIndentCheckBoxChange
TabOrder = 9
end
object TabIndentBlocksCheckBox: TCheckBox[29]
object TabIndentBlocksCheckBox: TCheckBox[32]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = AutoIndentCheckBox
AnchorSideTop.Side = asrBottom
@ -440,7 +482,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = TabIndentBlocksCheckBoxChange
TabOrder = 10
end
object SmartTabsCheckBox: TCheckBox[30]
object SmartTabsCheckBox: TCheckBox[33]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = IndentsTabsGroupLabel
AnchorSideTop.Side = asrBottom
@ -454,7 +496,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = SmartTabsCheckBoxChange
TabOrder = 11
end
object TabsToSpacesCheckBox: TCheckBox[31]
object TabsToSpacesCheckBox: TCheckBox[34]
AnchorSideLeft.Control = SmartTabsCheckBox
AnchorSideTop.Control = TabIndentBlocksCheckBox
Left = 236
@ -465,7 +507,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = TabsToSpacesCheckBoxChange
TabOrder = 12
end
object DropFilesCheckBox: TCheckBox[32]
object DropFilesCheckBox: TCheckBox[35]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = MouseGroupLabel
AnchorSideTop.Side = asrBottom
@ -478,7 +520,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = DropFilesCheckBoxChange
TabOrder = 13
end
object KeepCursorXCheckBox: TCheckBox[33]
object KeepCursorXCheckBox: TCheckBox[36]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CursorGroupLabel
AnchorSideTop.Side = asrBottom
@ -492,7 +534,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = KeepCursorXCheckBoxChange
TabOrder = 14
end
object PersistentCursorCheckBox: TCheckBox[34]
object PersistentCursorCheckBox: TCheckBox[37]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = KeepCursorXCheckBox
AnchorSideTop.Side = asrBottom
@ -505,7 +547,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = PersistentCursorCheckBoxChange
TabOrder = 15
end
object AlwaysVisibleCursorCheckBox: TCheckBox[35]
object AlwaysVisibleCursorCheckBox: TCheckBox[38]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PersistentCursorCheckBox
AnchorSideTop.Side = asrBottom
@ -518,7 +560,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = AlwaysVisibleCursorCheckBoxChange
TabOrder = 16
end
object CursorSkipsSelectionCheckBox: TCheckBox[36]
object CursorSkipsSelectionCheckBox: TCheckBox[39]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CursorGroupLabel
AnchorSideTop.Side = asrBottom
@ -532,7 +574,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = CursorSkipsSelectionCheckBoxChange
TabOrder = 17
end
object HomeKeyJumpsToNearestStartCheckBox: TCheckBox[37]
object HomeKeyJumpsToNearestStartCheckBox: TCheckBox[40]
AnchorSideLeft.Control = CursorSkipsSelectionCheckBox
AnchorSideTop.Control = PersistentCursorCheckBox
Left = 236
@ -543,7 +585,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = HomeKeyJumpsToNearestStartCheckBoxChange
TabOrder = 18
end
object EndKeyJumpsToNearestStartCheckBox: TCheckBox[38]
object EndKeyJumpsToNearestStartCheckBox: TCheckBox[41]
AnchorSideLeft.Control = HomeKeyJumpsToNearestStartCheckBox
AnchorSideTop.Control = AlwaysVisibleCursorCheckBox
Left = 236
@ -554,7 +596,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
OnChange = EndKeyJumpsToNearestStartCheckBoxChange
TabOrder = 19
end
object BlockIndentTypeComboBox: TComboBox[39]
object BlockIndentTypeComboBox: TComboBox[42]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = BlockIndentComboBox
AnchorSideTop.Side = asrBottom
@ -573,4 +615,17 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
Style = csDropDownList
TabOrder = 20
end
object PersistentBlockCheckBox: TCheckBox[43]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = BlockGroupLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 411
Width = 152
BorderSpacing.Left = 6
Caption = 'PersistentBlockCheckBox'
OnChange = PersistentBlockCheckBoxChange
TabOrder = 21
end
end

View File

@ -101,116 +101,137 @@ LazarusResources.Add('TEditorGeneralOptionsFrame','FORMDATA',[
+'Top.Control'#7#16'CursorGroupLabel'#18'AnchorSideTop.Side'#7#9'asrCenter'#23
+'AnchorSideRight.Control'#7#7'Bevel1a'#20'AnchorSideRight.Side'#7#9'asrBotto'
+'m'#4'Left'#2#0#6'Height'#2#3#3'Top'#3'*'#1#5'Width'#2'<'#7'Anchors'#11#5'ak'
+'Top'#6'akLeft'#7'akRight'#0#0#0#242#2#19#9'TComboBox'#19'BlockIndentComboBo'
+'x'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#23'Tab'
+'IndentBlocksCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#24'AnchorSideBo'
+'ttom.Control'#7#17'TabWidthsComboBox'#4'Left'#2#6#6'Height'#2#23#3'Top'#3
+#195#0#5'Width'#2'd'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#3#10
+'ItemHeight'#2#15#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#8'OnChan'
+'ge'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17
+'ComboboxOnKeyDown'#8'TabOrder'#2#0#0#0#242#2#20#9'TComboBox'#17'TabWidthsCo'
+'mboBox'#22'AnchorSideLeft.Control'#7#17'SmartTabsCheckBox'#21'AnchorSideTop'
+'.Control'#7#19'BlockIndentComboBox'#24'AnchorSideBottom.Control'#7#5'Owner'
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#236#0#6'Height'#2#23#3'T'
+'op'#3#195#0#5'Width'#2'd'#10'ItemHeight'#2#15#13'Items.Strings'#1#6#1'1'#6#1
+'2'#6#1'4'#6#1'8'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboB'
+'oxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0#0#242#2#21
+#9'TComboBox'#17'UndoLimitComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21
+'AnchorSideTop.Control'#7#14'UndoGroupLabel'#18'AnchorSideTop.Side'#7#9'asrB'
+'ottom'#4'Left'#3#236#0#6'Height'#2#23#3'Top'#2#22#5'Width'#2'd'#18'BorderSp'
+'acing.Left'#3#230#0#20'BorderSpacing.Around'#2#6#10'ItemHeight'#2#15#13'Ite'
+'ms.Strings'#1#6#5'32767'#6#4'4096'#6#3'512'#0#8'OnChange'#7#16'ComboboxOnCh'
+'ange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8
+'TabOrder'#2#2#0#0#242#2#22#9'TCheckBox'#17'GroupUndoCheckBox'#22'AnchorSide'
+'Left.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#21'UndoAfterSaveCheckB'
+'ox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'
+#2')'#5'Width'#3#134#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#17'GroupUndoC'
+'heckBox'#8'OnChange'#7#23'GroupUndoCheckBoxChange'#8'TabOrder'#2#3#0#0#242#2
+#23#9'TCheckBox'#21'UndoAfterSaveCheckBox'#22'AnchorSideLeft.Control'#7#5'Ow'
+'ner'#21'AnchorSideTop.Control'#7#14'UndoGroupLabel'#18'AnchorSideTop.Side'#7
+#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2#22#5'Width'#3#151#0#18'Bor'
,'derSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#21'UndoAfterSav'
+'eCheckBox'#8'TabOrder'#2#4#0#0#242#2#24#9'TCheckBox'#25'ScrollPastEndFileCh'
+'eckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#16
+'ScrollGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Heigh'
+'t'#2#19#3'Top'#2'X'#5'Width'#3#161#0#18'BorderSpacing.Left'#2#6#17'BorderSp'
+'acing.Top'#2#6#7'Caption'#6#25'ScrollPastEndFileCheckBox'#8'OnChange'#7#31
+'ScrollPastEndFileCheckBoxChange'#8'TabOrder'#2#5#0#0#242#2#25#9'TCheckBox'
+#25'ScrollPastEndLineCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anch'
+'orSideTop.Control'#7#27'AlwaysVisibleCursorCheckBox'#18'AnchorSideTop.Side'
+#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3'r'#1#5'Width'#3#165#0#18
+'BorderSpacing.Left'#2#6#7'Caption'#6#25'ScrollPastEndLineCheckBox'#8'OnChan'
+'ge'#7#31'ScrollPastEndLineCheckBoxChange'#8'TabOrder'#2#6#0#0#242#2#26#9'TC'
+'heckBox'#23'ScrollByOneLessCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7#16'ScrollGroupLabel'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#2'X'#5'Width'#3#158#0#18'B'
+'orderSpacing.Left'#3#230#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#23'Scr'
+'ollByOneLessCheckBox'#8'OnChange'#7#29'ScrollByOneLessCheckBoxChange'#8'Tab'
+'Order'#2#7#0#0#242#2#27#9'TCheckBox'#22'HalfPageScrollCheckBox'#22'AnchorSi'
+'deLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#25'ScrollPastEndFile'
+'CheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3
+'Top'#2'k'#5'Width'#3#149#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#22'HalfP'
+'ageScrollCheckBox'#8'OnChange'#7#28'HalfPageScrollCheckBoxChange'#8'TabOrde'
+'r'#2#8#0#0#242#2#28#9'TCheckBox'#18'AutoIndentCheckBox'#22'AnchorSideLeft.C'
+'ontrol'#7#5'Owner'#21'AnchorSideTop.Control'#7#21'IndentsTabsGroupLabel'#18
+'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3#154#0
+#5'Width'#3#132#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Cap'
+'tion'#6#18'AutoIndentCheckBox'#8'OnChange'#7#24'AutoIndentCheckBoxChange'#8
+'TabOrder'#2#9#0#0#242#2#29#9'TCheckBox'#23'TabIndentBlocksCheckBox'#22'Anch'
+'orSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#18'AutoIndentChe'
+'ckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'T'
+'op'#3#173#0#5'Width'#3#160#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#23'Tab'
+'IndentBlocksCheckBox'#8'OnChange'#7#29'TabIndentBlocksCheckBoxChange'#8'Tab'
+'Order'#2#10#0#0#242#2#30#9'TCheckBox'#17'SmartTabsCheckBox'#22'AnchorSideLe'
+'ft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#21'IndentsTabsGroupLabel'
+#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#236#0#6'Height'#2#19#3'Top'
+#3#154#0#5'Width'#3#128#0#18'BorderSpacing.Left'#3#230#0#20'BorderSpacing.Ar'
+'ound'#2#6#7'Caption'#6#17'SmartTabsCheckBox'#8'OnChange'#7#23'SmartTabsChec'
+'kBoxChange'#8'TabOrder'#2#11#0#0#242#2#31#9'TCheckBox'#20'TabsToSpacesCheck'
+'Box'#22'AnchorSideLeft.Control'#7#17'SmartTabsCheckBox'#21'AnchorSideTop.Co'
+'ntrol'#7#23'TabIndentBlocksCheckBox'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3
+#173#0#5'Width'#3#147#0#7'Caption'#6#20'TabsToSpacesCheckBox'#8'OnChange'#7
+#26'TabsToSpacesCheckBoxChange'#8'TabOrder'#2#12#0#0#242#2' '#9'TCheckBox'#17
+'DropFilesCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.C'
+'ontrol'#7#15'MouseGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'
+#2#6#6'Height'#2#19#3'Top'#3#10#1#5'Width'#2'y'#18'BorderSpacing.Left'#2#6#7
+'Caption'#6#17'DropFilesCheckBox'#8'OnChange'#7#23'DropFilesCheckBoxChange'#8
+'TabOrder'#2#13#0#0#242#2'!'#9'TCheckBox'#19'KeepCursorXCheckBox'#22'AnchorS'
+'ideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#16'CursorGroupLabel'
+#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3'9'
+#1#5'Width'#3#140#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'C'
+'aption'#6#19'KeepCursorXCheckBox'#8'OnChange'#7#25'KeepCursorXCheckBoxChang'
+'e'#8'TabOrder'#2#14#0#0#242#2'"'#9'TCheckBox'#24'PersistentCursorCheckBox'
+#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#19'KeepCu'
+'rsorXCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2
+#19#3'Top'#3'L'#1#5'Width'#3#158#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#24
+'PersistentCursorCheckBox'#8'OnChange'#7#30'PersistentCursorCheckBoxChange'#8
+'TabOrder'#2#15#0#0#242#2'#'#9'TCheckBox'#27'AlwaysVisibleCursorCheckBox'#22
+'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#24'Persisten'
+'tCursorCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'
+#2#19#3'Top'#3'_'#1#5'Width'#3#178#0#18'BorderSpacing.Left'#2#6#7'Caption'#6
+#27'AlwaysVisibleCursorCheckBox'#8'OnChange'#7'!AlwaysVisibleCursorCheckBoxC'
+'hange'#8'TabOrder'#2#16#0#0#242#2'$'#9'TCheckBox'#28'CursorSkipsSelectionCh'
+'eckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#16
+'CursorGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#236#0#6'H'
,'eight'#2#19#3'Top'#3'9'#1#5'Width'#3#182#0#18'BorderSpacing.Left'#3#230#0#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#28'CursorSkipsSelectionCheckBox'#8'O'
+'nChange'#7'"CursorSkipsSelectionCheckBoxChange'#8'TabOrder'#2#17#0#0#242#2
+'%'#9'TCheckBox"HomeKeyJumpsToNearestStartCheckBox'#22'AnchorSideLeft.Contro'
+'l'#7#28'CursorSkipsSelectionCheckBox'#21'AnchorSideTop.Control'#7#24'Persis'
+'tentCursorCheckBox'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3'L'#1#5'Width'#3
+#236#0#7'Caption'#6'"HomeKeyJumpsToNearestStartCheckBox'#8'OnChange'#7'(Home'
+'KeyJumpsToNearestStartCheckBoxChange'#8'TabOrder'#2#18#0#0#242#2'&'#9'TChec'
+'kBox!EndKeyJumpsToNearestStartCheckBox'#22'AnchorSideLeft.Control'#7'"HomeK'
+'eyJumpsToNearestStartCheckBox'#21'AnchorSideTop.Control'#7#27'AlwaysVisible'
+'CursorCheckBox'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3'_'#1#5'Width'#3#223
+#0#7'Caption'#6'!EndKeyJumpsToNearestStartCheckBox'#8'OnChange'#7'''EndKeyJu'
+'mpsToNearestStartCheckBoxChange'#8'TabOrder'#2#19#0#0#242#2''''#9'TComboBox'
+#23'BlockIndentTypeComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor'
+'SideTop.Control'#7#19'BlockIndentComboBox'#18'AnchorSideTop.Side'#7#9'asrBo'
+'ttom'#24'AnchorSideBottom.Control'#7#17'TabWidthsComboBox'#4'Left'#2#6#6'He'
+'ight'#2#23#3'Top'#3#221#0#5'Width'#2'd'#18'BorderSpacing.Left'#2#6#17'Borde'
+'rSpacing.Top'#2#3#10'ItemHeight'#2#15#9'ItemWidth'#3#200#0#8'OnChange'#7#16
+'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'Combobox'
+'OnKeyDown'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#20#0#0#0
+'Top'#6'akLeft'#7'akRight'#0#0#0#242#2#19#6'TBevel'#7'Bevel6a'#22'AnchorSide'
+'Left.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#15'BlockGroupLabel'#18
+'AnchorSideTop.Side'#7#9'asrCenter'#23'AnchorSideRight.Control'#7#7'Bevel1a'
+#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#3#3'Top'#3
+#146#1#5'Width'#2'<'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#0#0#242#2
+#20#6'TLabel'#15'BlockGroupLabel'#22'AnchorSideLeft.Control'#7#7'Bevel5a'#19
+'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#25'ScrollPa'
+'stEndLineCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'F'#6'Hei'
+'ght'#2#16#3'Top'#3#139#1#5'Width'#2'`'#18'BorderSpacing.Left'#2#10#17'Borde'
+'rSpacing.Top'#2#6#7'Caption'#6#15'BlockGroupLabel'#10'Font.Style'#11#6'fsBo'
+'ld'#0#11'ParentColor'#8#10'ParentFont'#8#0#0#242#2#21#6'TBevel'#6'Bevel6'#22
+'AnchorSideLeft.Control'#7#16'CursorGroupLabel'#19'AnchorSideLeft.Side'#7#9
+'asrBottom'#21'AnchorSideTop.Control'#7#15'BlockGroupLabel'#18'AnchorSideTop'
+'.Side'#7#9'asrCenter'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideR'
+'ight.Side'#7#9'asrBottom'#4'Left'#3#181#0#6'Height'#2#3#3'Top'#3#146#1#5'Wi'
+'dth'#3#22#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.'
+'Left'#2#10#0#0#242#2#22#9'TComboBox'#19'BlockIndentComboBox'#22'AnchorSideL'
+'eft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#23'TabIndentBlocksCheck'
+'Box'#18'AnchorSideTop.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#17
+'TabWidthsComboBox'#4'Left'#2#6#6'Height'#2#23#3'Top'#3#195#0#5'Width'#2'd'
+#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#3#10'ItemHeight'#2#15#13
+'Items.Strings'#1#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#8'OnChange'#7#16'ComboboxOnC'
+'hange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8
+'TabOrder'#2#0#0#0#242#2#23#9'TComboBox'#17'TabWidthsComboBox'#22'AnchorSide'
+'Left.Control'#7#17'SmartTabsCheckBox'#21'AnchorSideTop.Control'#7#19'BlockI'
+'ndentComboBox'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.'
+'Side'#7#9'asrBottom'#4'Left'#3#236#0#6'Height'#2#23#3'Top'#3#195#0#5'Width'
+#2'd'#10'ItemHeight'#2#15#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#8
,'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'
+#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0#0#242#2#24#9'TComboBox'#17'UndoLi'
+'mitComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'
+#7#14'UndoGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#236#0#6
+'Height'#2#23#3'Top'#2#22#5'Width'#2'd'#18'BorderSpacing.Left'#3#230#0#20'Bo'
+'rderSpacing.Around'#2#6#10'ItemHeight'#2#15#13'Items.Strings'#1#6#5'32767'#6
+#4'4096'#6#3'512'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboB'
+'oxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#2#0#0#242#2#25
+#9'TCheckBox'#17'GroupUndoCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21
+'AnchorSideTop.Control'#7#21'UndoAfterSaveCheckBox'#18'AnchorSideTop.Side'#7
+#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2')'#5'Width'#3#134#0#18'Bor'
+'derSpacing.Left'#2#6#7'Caption'#6#17'GroupUndoCheckBox'#8'OnChange'#7#23'Gr'
+'oupUndoCheckBoxChange'#8'TabOrder'#2#3#0#0#242#2#26#9'TCheckBox'#21'UndoAft'
+'erSaveCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont'
+'rol'#7#14'UndoGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6
+#6'Height'#2#19#3'Top'#2#22#5'Width'#3#151#0#18'BorderSpacing.Left'#2#6#17'B'
+'orderSpacing.Top'#2#6#7'Caption'#6#21'UndoAfterSaveCheckBox'#8'TabOrder'#2#4
+#0#0#242#2#27#9'TCheckBox'#25'ScrollPastEndFileCheckBox'#22'AnchorSideLeft.C'
+'ontrol'#7#5'Owner'#21'AnchorSideTop.Control'#7#16'ScrollGroupLabel'#18'Anch'
+'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'X'#5'Wid'
+'th'#3#161#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'
+#6#25'ScrollPastEndFileCheckBox'#8'OnChange'#7#31'ScrollPastEndFileCheckBoxC'
+'hange'#8'TabOrder'#2#5#0#0#242#2#28#9'TCheckBox'#25'ScrollPastEndLineCheckB'
+'ox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#27'Al'
+'waysVisibleCursorCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6
+#6'Height'#2#19#3'Top'#3'r'#1#5'Width'#3#165#0#18'BorderSpacing.Left'#2#6#7
+'Caption'#6#25'ScrollPastEndLineCheckBox'#8'OnChange'#7#31'ScrollPastEndLine'
+'CheckBoxChange'#8'TabOrder'#2#6#0#0#242#2#29#9'TCheckBox'#23'ScrollByOneLes'
+'sCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7
+#16'ScrollGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#236#0#6
+'Height'#2#19#3'Top'#2'X'#5'Width'#3#158#0#18'BorderSpacing.Left'#3#230#0#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#23'ScrollByOneLessCheckBox'#8'OnChan'
+'ge'#7#29'ScrollByOneLessCheckBoxChange'#8'TabOrder'#2#7#0#0#242#2#30#9'TChe'
+'ckBox'#22'HalfPageScrollCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21
+'AnchorSideTop.Control'#7#25'ScrollPastEndFileCheckBox'#18'AnchorSideTop.Sid'
+'e'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'k'#5'Width'#3#149#0#18
+'BorderSpacing.Left'#2#6#7'Caption'#6#22'HalfPageScrollCheckBox'#8'OnChange'
+#7#28'HalfPageScrollCheckBoxChange'#8'TabOrder'#2#8#0#0#242#2#31#9'TCheckBox'
+#18'AutoIndentCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideT'
+'op.Control'#7#21'IndentsTabsGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBotto'
+'m'#4'Left'#2#6#6'Height'#2#19#3'Top'#3#154#0#5'Width'#3#132#0#18'BorderSpac'
+'ing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#18'AutoIndentCheckBox'
+#8'OnChange'#7#24'AutoIndentCheckBoxChange'#8'TabOrder'#2#9#0#0#242#2' '#9'T'
+'CheckBox'#23'TabIndentBlocksCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7#18'AutoIndentCheckBox'#18'AnchorSideTop.Side'#7
+#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3#173#0#5'Width'#3#160#0#18
+'BorderSpacing.Left'#2#6#7'Caption'#6#23'TabIndentBlocksCheckBox'#8'OnChange'
+#7#29'TabIndentBlocksCheckBoxChange'#8'TabOrder'#2#10#0#0#242#2'!'#9'TCheckB'
+'ox'#17'SmartTabsCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSi'
+'deTop.Control'#7#21'IndentsTabsGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBo'
+'ttom'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3#154#0#5'Width'#3#128#0#18'Bor'
+'derSpacing.Left'#3#230#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#17'Smart'
+'TabsCheckBox'#8'OnChange'#7#23'SmartTabsCheckBoxChange'#8'TabOrder'#2#11#0#0
+#242#2'"'#9'TCheckBox'#20'TabsToSpacesCheckBox'#22'AnchorSideLeft.Control'#7
+#17'SmartTabsCheckBox'#21'AnchorSideTop.Control'#7#23'TabIndentBlocksCheckBo'
+'x'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3#173#0#5'Width'#3#147#0#7'Caption'
+#6#20'TabsToSpacesCheckBox'#8'OnChange'#7#26'TabsToSpacesCheckBoxChange'#8'T'
+'abOrder'#2#12#0#0#242#2'#'#9'TCheckBox'#17'DropFilesCheckBox'#22'AnchorSide'
+'Left.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#15'MouseGroupLabel'#18
+'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3#10#1
+#5'Width'#2'y'#18'BorderSpacing.Left'#2#6#7'Caption'#6#17'DropFilesCheckBox'
+#8'OnChange'#7#23'DropFilesCheckBoxChange'#8'TabOrder'#2#13#0#0#242#2'$'#9'T'
+'CheckBox'#19'KeepCursorXCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21
+'AnchorSideTop.Control'#7#16'CursorGroupLabel'#18'AnchorSideTop.Side'#7#9'as'
,'rBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3'9'#1#5'Width'#3#140#0#18'Borde'
+'rSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#19'KeepCursorXChe'
+'ckBox'#8'OnChange'#7#25'KeepCursorXCheckBoxChange'#8'TabOrder'#2#14#0#0#242
+#2'%'#9'TCheckBox'#24'PersistentCursorCheckBox'#22'AnchorSideLeft.Control'#7
+#5'Owner'#21'AnchorSideTop.Control'#7#19'KeepCursorXCheckBox'#18'AnchorSideT'
+'op.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3'L'#1#5'Width'#3
+#158#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#24'PersistentCursorCheckBox'#8
+'OnChange'#7#30'PersistentCursorCheckBoxChange'#8'TabOrder'#2#15#0#0#242#2'&'
+#9'TCheckBox'#27'AlwaysVisibleCursorCheckBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#24'PersistentCursorCheckBox'#18'AnchorSi'
+'deTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#19#3'Top'#3'_'#1#5'Width'
+#3#178#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#27'AlwaysVisibleCursorCheck'
+'Box'#8'OnChange'#7'!AlwaysVisibleCursorCheckBoxChange'#8'TabOrder'#2#16#0#0
+#242#2''''#9'TCheckBox'#28'CursorSkipsSelectionCheckBox'#22'AnchorSideLeft.C'
+'ontrol'#7#5'Owner'#21'AnchorSideTop.Control'#7#16'CursorGroupLabel'#18'Anch'
+'orSideTop.Side'#7#9'asrBottom'#4'Left'#3#236#0#6'Height'#2#19#3'Top'#3'9'#1
+#5'Width'#3#182#0#18'BorderSpacing.Left'#3#230#0#20'BorderSpacing.Around'#2#6
+#7'Caption'#6#28'CursorSkipsSelectionCheckBox'#8'OnChange'#7'"CursorSkipsSel'
+'ectionCheckBoxChange'#8'TabOrder'#2#17#0#0#242#2'('#9'TCheckBox"HomeKeyJump'
+'sToNearestStartCheckBox'#22'AnchorSideLeft.Control'#7#28'CursorSkipsSelecti'
+'onCheckBox'#21'AnchorSideTop.Control'#7#24'PersistentCursorCheckBox'#4'Left'
+#3#236#0#6'Height'#2#19#3'Top'#3'L'#1#5'Width'#3#236#0#7'Caption'#6'"HomeKey'
+'JumpsToNearestStartCheckBox'#8'OnChange'#7'(HomeKeyJumpsToNearestStartCheck'
+'BoxChange'#8'TabOrder'#2#18#0#0#242#2')'#9'TCheckBox!EndKeyJumpsToNearestSt'
+'artCheckBox'#22'AnchorSideLeft.Control'#7'"HomeKeyJumpsToNearestStartCheckB'
+'ox'#21'AnchorSideTop.Control'#7#27'AlwaysVisibleCursorCheckBox'#4'Left'#3
+#236#0#6'Height'#2#19#3'Top'#3'_'#1#5'Width'#3#223#0#7'Caption'#6'!EndKeyJum'
+'psToNearestStartCheckBox'#8'OnChange'#7'''EndKeyJumpsToNearestStartCheckBox'
+'Change'#8'TabOrder'#2#19#0#0#242#2'*'#9'TComboBox'#23'BlockIndentTypeComboB'
+'ox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#19'Bl'
+'ockIndentComboBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#24'AnchorSideBotto'
+'m.Control'#7#17'TabWidthsComboBox'#4'Left'#2#6#6'Height'#2#23#3'Top'#3#221#0
+#5'Width'#2'd'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#3#10'ItemH'
+'eight'#2#15#9'ItemWidth'#3#200#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExi'
+'t'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#5'Style'#7#14
+'csDropDownList'#8'TabOrder'#2#20#0#0#242#2'+'#9'TCheckBox'#23'PersistentBlo'
+'ckCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'
+#7#15'BlockGroupLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'H'
+'eight'#2#19#3'Top'#3#155#1#5'Width'#3#152#0#18'BorderSpacing.Left'#2#6#7'Ca'
+'ption'#6#23'PersistentBlockCheckBox'#8'OnChange'#7#29'PersistentBlockCheckB'
+'oxChange'#8'TabOrder'#2#21#0#0#0
]);

View File

@ -44,11 +44,14 @@ type
Bevel4: TBevel;
Bevel5: TBevel;
Bevel1a: TBevel;
Bevel6: TBevel;
Bevel6a: TBevel;
BlockIndentComboBox: TComboBox;
BlockIndentTypeComboBox: TComboBox;
BlockIndentLabel: TLabel;
AutoIndentCheckBox: TCheckBox;
BlockIndentTypeLabel: TLabel;
BlockGroupLabel: TLabel;
EndKeyJumpsToNearestStartCheckBox: TCheckBox;
KeepCursorXCheckBox: TCheckBox;
PersistentCursorCheckBox: TCheckBox;
@ -58,6 +61,7 @@ type
CursorGroupLabel: TLabel;
DropFilesCheckBox: TCheckBox;
MouseGroupLabel: TLabel;
PersistentBlockCheckBox: TCheckBox;
TabIndentBlocksCheckBox: TCheckBox;
SmartTabsCheckBox: TCheckBox;
TabsToSpacesCheckBox: TCheckBox;
@ -87,6 +91,7 @@ type
procedure HalfPageScrollCheckBoxChange(Sender: TObject);
procedure HomeKeyJumpsToNearestStartCheckBoxChange(Sender: TObject);
procedure KeepCursorXCheckBoxChange(Sender: TObject);
procedure PersistentBlockCheckBoxChange(Sender: TObject);
procedure PersistentCursorCheckBoxChange(Sender: TObject);
procedure ScrollByOneLessCheckBoxChange(Sender: TObject);
procedure ScrollPastEndFileCheckBoxChange(Sender: TObject);
@ -161,6 +166,10 @@ begin
CursorSkipsSelectionCheckBox.Caption := dlgCursorSkipsSelection;
HomeKeyJumpsToNearestStartCheckBox.Caption := dlgHomeKeyJumpsToNearestStart;
EndKeyJumpsToNearestStartCheckBox.Caption := dlgEndKeyJumpsToNearestStart;
// Block
BlockGroupLabel.Caption := dlgBlockGroupOptions;
PersistentBlockCheckBox.Caption := dlgPersistentBlock;
end;
procedure TEditorGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
@ -201,6 +210,9 @@ begin
HomeKeyJumpsToNearestStartCheckBox.Checked := eoEnhanceHomeKey in SynEditOptions;
EndKeyJumpsToNearestStartCheckBox.Checked := eoEnhanceEndKey in SynEditOptions2;
// block
PersistentBlockCheckBox.Checked := eoPersistentBlock in SynEditOptions2;
for i := Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[i] <> nil then
GetSynEditPreviewSettings(PreviewEdits[i]);
@ -277,6 +289,9 @@ begin
UpdateOptionFromBool(CursorSkipsSelectionCheckBox.Checked, eoCaretSkipsSelection);
UpdateOptionFromBool(HomeKeyJumpsToNearestStartCheckBox.Checked, eoEnhanceHomeKey);
UpdateOptionFromBool(EndKeyJumpsToNearestStartCheckBox.Checked, eoEnhanceEndKey);
// block
UpdateOptionFromBool(PersistentBlockCheckBox.Checked, eoPersistentBlock);
end;
end;
@ -401,6 +416,11 @@ begin
SetPreviewOption(KeepCursorXCheckBox.Checked, eoKeepCaretX);
end;
procedure TEditorGeneralOptionsFrame.PersistentBlockCheckBoxChange(Sender: TObject);
begin
SetPreviewOption(PersistentBlockCheckBox.Checked, eoPersistentBlock);
end;
procedure TEditorGeneralOptionsFrame.PersistentCursorCheckBoxChange(
Sender: TObject);
begin

View File

@ -272,6 +272,17 @@ begin
ecSelectionSort: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[]);
ecSelectionBreakLines: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[]);
ecBlockSetBegin : SetResult2(VK_K,[ssCtrl],VK_B,[], VK_K,[ssCtrl],VK_B,[ssCtrl]);
ecBlockSetEnd : SetResult2(VK_K,[ssCtrl],VK_K,[], VK_K,[ssCtrl],VK_K,[ssCtrl]);
ecBlockToggleHide : SetResult2(VK_K,[ssCtrl],VK_H,[], VK_K,[ssCtrl],VK_H,[ssCtrl]);
ecBlockHide : SetResult2(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockShow : SetResult2(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockMove : SetResult2(VK_K,[ssCtrl],VK_V,[], VK_K,[ssCtrl],VK_V,[ssCtrl]);
ecBlockCopy : SetResult2(VK_K,[ssCtrl],VK_C,[], VK_K,[ssCtrl],VK_C,[ssCtrl]);
ecBlockDelete : SetResult2(VK_K,[ssCtrl],VK_Y,[], VK_K,[ssCtrl],VK_Y,[ssCtrl]);
ecBlockGotoBegin : SetResult2(VK_Q,[ssCtrl],VK_B,[], VK_Q,[ssCtrl],VK_B,[ssCtrl]);
ecBlockGotoEnd : SetResult2(VK_Q,[ssCtrl],VK_K,[], VK_Q,[ssCtrl],VK_K,[ssCtrl]);
// column mode selection
ecColSelUp: SetResult(VK_UP, [ssAlt, ssShift], VK_UNKNOWN,[]);
ecColSelDown: SetResult(VK_DOWN, [ssAlt, ssShift], VK_UNKNOWN,[]);
@ -695,6 +706,17 @@ begin
ecSelectionSort: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[], VK_UNKNOWN, [], VK_UNKNOWN, []);
ecSelectionBreakLines: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[], VK_UNKNOWN, [], VK_UNKNOWN, []);
ecBlockSetBegin : SetResult(VK_K,[ssCtrl],VK_B,[], VK_K,[ssCtrl],VK_B,[ssCtrl]);
ecBlockSetEnd : SetResult(VK_K,[ssCtrl],VK_K,[], VK_K,[ssCtrl],VK_K,[ssCtrl]);
ecBlockToggleHide : SetResult(VK_K,[ssCtrl],VK_H,[], VK_K,[ssCtrl],VK_H,[ssCtrl]);
ecBlockHide : SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockShow : SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockMove : SetResult(VK_K,[ssCtrl],VK_V,[], VK_K,[ssCtrl],VK_V,[ssCtrl]);
ecBlockCopy : SetResult(VK_K,[ssCtrl],VK_C,[], VK_K,[ssCtrl],VK_C,[ssCtrl]);
ecBlockDelete : SetResult(VK_K,[ssCtrl],VK_Y,[], VK_K,[ssCtrl],VK_Y,[ssCtrl]);
ecBlockGotoBegin : SetResult(VK_Q,[ssCtrl],VK_B,[], VK_Q,[ssCtrl],VK_B,[ssCtrl]);
ecBlockGotoEnd : SetResult(VK_Q,[ssCtrl],VK_K,[], VK_Q,[ssCtrl],VK_K,[ssCtrl]);
// column mode selection
ecColSelUp: SetResult(VK_UP, [ssAlt, ssShift], VK_UNKNOWN,[], VK_UNKNOWN,[], VK_UNKNOWN,[]);
ecColSelDown: SetResult(VK_DOWN, [ssAlt, ssShift], VK_UNKNOWN,[], VK_UNKNOWN,[], VK_UNKNOWN,[]);
@ -1270,6 +1292,17 @@ begin
ecSelectionSort: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[]);
ecSelectionBreakLines: SetResult(VK_UNKNOWN, [],VK_UNKNOWN,[]);
ecBlockSetBegin : SetResult2(VK_K,[ssCtrl],VK_B,[], VK_K,[ssCtrl],VK_B,[ssCtrl]);
ecBlockSetEnd : SetResult2(VK_K,[ssCtrl],VK_K,[], VK_K,[ssCtrl],VK_K,[ssCtrl]);
ecBlockToggleHide : SetResult2(VK_K,[ssCtrl],VK_H,[], VK_K,[ssCtrl],VK_H,[ssCtrl]);
ecBlockHide : SetResult2(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockShow : SetResult2(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecBlockMove : SetResult2(VK_K,[ssCtrl],VK_V,[], VK_K,[ssCtrl],VK_V,[ssCtrl]);
ecBlockCopy : SetResult2(VK_K,[ssCtrl],VK_C,[], VK_K,[ssCtrl],VK_C,[ssCtrl]);
ecBlockDelete : SetResult2(VK_K,[ssCtrl],VK_Y,[], VK_K,[ssCtrl],VK_Y,[ssCtrl]);
ecBlockGotoBegin : SetResult2(VK_Q,[ssCtrl],VK_B,[], VK_Q,[ssCtrl],VK_B,[ssCtrl]);
ecBlockGotoEnd : SetResult2(VK_Q,[ssCtrl],VK_K,[], VK_Q,[ssCtrl],VK_K,[ssCtrl]);
// column mode selection
ecColSelUp: SetResult(VK_UP, [ssAlt, ssShift], VK_UNKNOWN,[]);
ecColSelDown: SetResult(VK_DOWN, [ssAlt, ssShift], VK_UNKNOWN,[]);
@ -1794,6 +1827,17 @@ begin
ecToggleMarker0 ..
ecToggleMarker9 : Result:= Format(srkmecToggleMarker,[cmd-ecToggleMarker0]);
ecBlockSetBegin : Result := srkmecBlockSetBegin;
ecBlockSetEnd : Result := srkmecBlockSetEnd;
ecBlockToggleHide : Result := srkmecBlockToggleHide;
ecBlockHide : Result := srkmecBlockHide;
ecBlockShow : Result := srkmecBlockShow;
ecBlockMove : Result := srkmecBlockMove;
ecBlockCopy : Result := srkmecBlockCopy;
ecBlockDelete : Result := srkmecBlockDelete;
ecBlockGotoBegin : Result := srkmecBlockGotoBegin;
ecBlockGotoEnd : Result := srkmecBlockGotoEnd;
// sourcenotebook
ecNextEditor : Result:= srkmecNextEditor;
ecPrevEditor : Result:= srkmecPrevEditor;
@ -2275,6 +2319,17 @@ begin
AddDefault(C, 'Select paragraph', lisMenuSelectParagraph, ecSelectParagraph);
AddDefault(C, 'Toggle Current-Word highlight', srkmecToggleMarkupWord, EcToggleMarkupWord);
AddDefault(C, 'Set Block begin', srkmecBlockSetBegin, ecBlockSetBegin);
AddDefault(C, 'Set Block End', srkmecBlockSetEnd, ecBlockSetEnd);
AddDefault(C, 'Toggle Block', srkmecBlockToggleHide, ecBlockToggleHide);
AddDefault(C, 'Hide Block', srkmecBlockHide, ecBlockHide);
AddDefault(C, 'Show Block', srkmecBlockShow, ecBlockShow);
AddDefault(C, 'Move Block', srkmecBlockMove, ecBlockMove);
AddDefault(C, 'Copy Block', srkmecBlockCopy, ecBlockCopy);
AddDefault(C, 'Delete Block', srkmecBlockDelete, ecBlockDelete);
AddDefault(C, 'Goto Block Begin', srkmecBlockGotoBegin, ecBlockGotoBegin);
AddDefault(C, 'Goto Block End', srkmecBlockGotoEnd, ecBlockGotoEnd);
// column mode selection
C:=Categories[AddCategory('Column Selection',srkmCatColSelection,
IDECmdScopeSrcEditOnly)];

View File

@ -1140,6 +1140,7 @@ resourcestring
dlgIndentsTabsGroupOptions = 'Indent and Tabs:';
dlgMouseGroupOptions = 'Mouse:';
dlgCursorGroupOptions = 'Cursor:';
dlgBlockGroupOptions = 'Selection:';
dlgAlwaysVisibleCursor = 'Always visible cursor';
dlgAutoIndent = 'Auto indent';
dlgDropFiles = 'Drop files';
@ -1147,6 +1148,7 @@ resourcestring
dlgHalfPageScroll = 'Half page scroll';
dlgKeepCursorX = 'Keep cursor X position';
dlgPersistentCursor = 'Persistent cursor';
dlgPersistentBlock = 'Persistent Block';
dlgCursorSkipsSelection = 'Cursor skips selection';
dlgScrollByOneLess = 'Scroll by one less';
dlgScrollPastEndFile = 'Scroll past end of file';
@ -2036,6 +2038,18 @@ resourcestring
srkmecToggleMode = 'Toggle Mode';
srkmecBlockIndent = 'Indent block';
srkmecBlockUnindent = 'Unindent block';
srkmecBlockSetBegin = 'Set block begin';
srkmecBlockSetEnd = 'Set block end';
srkmecBlockToggleHide = 'Toggle block';
srkmecBlockHide = 'Hide Block';
srkmecBlockShow = 'Show Block';
srkmecBlockMove = 'Move Block';
srkmecBlockCopy = 'Copy Block';
srkmecBlockDelete = 'Delete Block';
srkmecBlockGotoBegin = 'Goto Block begin';
srkmecBlockGotoEnd = 'Goto Block end';
srkmecShiftTab = 'Shift Tab';
lisTab = 'Tab';
srkmecMatchBracket = 'Go to matching bracket';
@ -4276,7 +4290,7 @@ resourcestring
+'mode %s%s%s. The build mode must be a pascal identifier.';
lisThereIsAlreadyABuildModeWithTheName = 'There is already a build mode '
+'with the name %s%s%s.';
lisDuplicateFoundOfValue = 'Duplicate found of value %s%s%s.';
lisDuplicateFoundOfValue = 'Duplicate found of value %s%s%s.';
lisSetValue = 'Set value';
lisCreateFunction = 'Create function';
lisResult2 = 'Result:';

View File

@ -587,8 +587,9 @@ type
procedure ccExecute(Sender: TObject);
procedure ccCancel(Sender: TObject);
procedure ccComplete(var Value: string; SourceValue: string; KeyChar: TUTF8Char;
Shift: TShiftState);
procedure ccComplete(var Value: string; SourceValue: string;
var SourceStart, SourceEnd: TPoint;
KeyChar: TUTF8Char; Shift: TShiftState);
function OnSynCompletionPaintItem(const AKey: string; ACanvas: TCanvas;
X, Y: integer; ItemSelected: boolean; Index: integer): boolean;
function OnSynCompletionMeasureItem(const AKey: string; ACanvas: TCanvas;
@ -1158,10 +1159,6 @@ Begin
NewTopLine := P.Y - (FEditor.LinesInWindow div 2);
if NewTopLine < 1 then NewTopLine:=1;
FEditor.CaretXY := P;
with FEditor do begin
BlockBegin:=CaretXY;
BlockEnd:=CaretXY;
end;
FEditor.TopLine := NewTopLine;
Result:=FEditor.CaretY;
end;
@ -1816,7 +1813,7 @@ end;
function TSourceEditor.SelectionAvailable: boolean;
begin
Result:=CompareCaret(EditorComponent.BlockBegin,EditorComponent.BlockEnd)<>0;
Result := EditorComponent.SelAvail;
end;
function TSourceEditor.GetText(OnlySelection: boolean): string;
@ -2182,7 +2179,7 @@ begin
Txt:=CommentText(LCLProc.BreakString(
Format(Notice,[#13#13,#13#13,#13#13,#13#13,#13#13]),
FEditor.RightEdge-2,0),CommentType);
FEditor.SelText:=Txt;
FEditor.InsertTextAtCaret(Txt);
end;
procedure TSourceEditor.InsertGPLNotice(CommentType: TCommentType);
@ -2203,7 +2200,7 @@ end;
procedure TSourceEditor.InsertUsername;
begin
if ReadOnly then Exit;
FEditor.SelText:=GetCurrentUserName;
FEditor.InsertTextAtCaret(GetCurrentUserName);
end;
procedure TSourceEditor.InsertTodo;
@ -2215,7 +2212,7 @@ begin
aTodoItem := ExecuteTodoDialog;
try
if Assigned(aTodoItem) then
FEditor.SelText := aTodoItem.AsComment;
FEditor.InsertTextAtCaret(aTodoItem.AsComment);
finally
aTodoItem.Free;
end;
@ -2224,7 +2221,7 @@ end;
procedure TSourceEditor.InsertDateTime;
begin
if ReadOnly then Exit;
FEditor.SelText:=DateTimeToStr(now);
FEditor.InsertTextAtCaret(DateTimeToStr(now));
end;
procedure TSourceEditor.InsertChangeLogEntry;
@ -2232,13 +2229,13 @@ var s: string;
begin
if ReadOnly then Exit;
s:=DateToStr(now)+' '+GetCurrentUserName+' '+GetCurrentMailAddress;
FEditor.SelText:=s;
FEditor.InsertTextAtCaret(s);
end;
procedure TSourceEditor.InsertCVSKeyword(const AKeyWord: string);
begin
if ReadOnly then Exit;
FEditor.SelText:='$'+AKeyWord+'$'+LineEnding;
FEditor.InsertTextAtCaret('$'+AKeyWord+'$'+LineEnding);
end;
function TSourceEditor.GetSelEnd: Integer;
@ -2606,45 +2603,18 @@ end;
procedure TSourceEditor.OnCodeBufferChanged(Sender: TSourceLog;
SrcLogEntry: TSourceLogEntry);
procedure InsertTxt(const StartPos: TPoint; const Txt: string);
begin
FEditor.LogicalCaretXY:=StartPos;
FEditor.BlockBegin:=StartPos;
FEditor.BlockEnd:=StartPos;
FEditor.SelText:=Txt;
end;
procedure DeleteTxt(const StartPos, EndPos: TPoint);
begin
FEditor.LogicalCaretXY:=StartPos;
FEditor.BlockBegin:=StartPos;
FEditor.BlockEnd:=EndPos;
FEditor.SelText:='';
end;
procedure MoveTxt(const StartPos, EndPos, MoveToPos: TPoint;
DirectionForward: boolean);
var Txt: string;
begin
FEditor.LogicalCaretXY:=StartPos;
FEditor.BlockBegin:=StartPos;
FEditor.BlockEnd:=EndPos;
Txt:=FEditor.SelText;
if DirectionForward then begin
FEditor.LogicalCaretXY:=MoveToPos;
FEditor.BlockBegin:=MoveToPos;
FEditor.BlockEnd:=MoveToPos;
FEditor.SelText:=Txt;
FEditor.LogicalCaretXY:=StartPos;
FEditor.BlockBegin:=StartPos;
FEditor.BlockEnd:=EndPos;
FEditor.SelText:='';
FEditor.TextBetweenPoints[MoveToPos, MoveToPos] :=
FEditor.TextBetweenPoints[StartPos, EndPos];
FEditor.TextBetweenPoints[StartPos, EndPos] := '';
end else begin
FEditor.SelText:='';
FEditor.LogicalCaretXY:=MoveToPos;
FEditor.BlockBegin:=MoveToPos;
FEditor.BlockEnd:=MoveToPos;
FEditor.SelText:=Txt;
Txt := FEditor.TextBetweenPoints[StartPos, EndPos];
FEditor.TextBetweenPoints[StartPos, EndPos] := '';
FEditor.TextBetweenPoints[MoveToPos, MoveToPos] := Txt;;
end;
end;
@ -2665,7 +2635,7 @@ begin
begin
Sender.AbsoluteToLineCol(SrcLogEntry.Position,StartPos.Y,StartPos.X);
if StartPos.Y>=1 then
InsertTxt(StartPos,SrcLogEntry.Txt);
FEditor.TextBetweenPoints[StartPos, StartPos] := SrcLogEntry.Txt;
end;
sleoDelete:
begin
@ -2673,7 +2643,7 @@ begin
Sender.AbsoluteToLineCol(SrcLogEntry.Position+SrcLogEntry.Len,
EndPos.Y,EndPos.X);
if (StartPos.Y>=1) and (EndPos.Y>=1) then
DeleteTxt(StartPos,EndPos);
FEditor.TextBetweenPoints[StartPos, EndPos] := '';
end;
sleoMove:
begin
@ -2837,11 +2807,9 @@ procedure TSourceEditor.ReplaceLines(StartLine, EndLine: integer;
const NewText: string);
begin
if ReadOnly then Exit;
FEditor.BeginUndoBlock;
FEditor.BlockBegin:=Point(1,StartLine);
FEditor.BlockEnd:=Point(length(FEditor.Lines[Endline-1])+1,EndLine);
FEditor.SelText:=NewText;
FEditor.EndUndoBlock;
FEditor.TextBetweenPoints[Point(1,StartLine),
Point(length(FEditor.Lines[Endline-1])+1,EndLine)] :=
NewText;
end;
procedure TSourceEditor.EncloseSelection;
@ -3841,9 +3809,7 @@ begin
if NewPrefix<>OldPrefix then begin
AddPrefix:=copy(NewPrefix,length(OldPrefix)+1,length(NewPrefix));
CurCompletionControl.Editor.SelText:=AddPrefix;
CurCompletionControl.Editor.LogicalCaretXY:=
CurCompletionControl.Editor.BlockBegin;
CurCompletionControl.Editor.InsertTextAtCaret(AddPrefix);
if CurrentCompletionType=ctWordCompletion then begin
SL:=TStringList.Create;
try
@ -3989,8 +3955,8 @@ begin
end;
end;
procedure TSourceNotebook.ccComplete(var Value: string; SourceValue: string; KeyChar: TUTF8Char;
Shift: TShiftState);
procedure TSourceNotebook.ccComplete(var Value: string; SourceValue: string;
var SourceStart, SourceEnd: TPoint; KeyChar: TUTF8Char; Shift: TShiftState);
// completion selected -> deactivate completion form
// Called when user has selected a completion item
@ -4053,15 +4019,16 @@ Begin
// insert value plus special chars like brackets, semicolons, ...
SrcEdit:=GetActiveSE;
Editor:=SrcEdit.EditorComponent;
Editor.SelText:=NewValue;
Editor.TextBetweenPoints[SourceStart, SourceEnd] := NewValue;
if CursorToLeft>0 then
begin
NewCaretXY:=Editor.LogicalToPhysicalPos(Editor.BlockEnd);
NewCaretXY:=Editor.CaretXY;
dec(NewCaretXY.X,CursorToLeft);
Editor.CaretXY:=NewCaretXY;
end;
ccSelection := '';
Value:='';
SourceEnd := SourceStart;
end;
ctTemplateCompletion:
@ -4082,6 +4049,7 @@ Begin
if Value<>'' then
FCodeTemplateModul.ExecuteCompletion(Value,
GetActiveSE.EditorComponent);
SourceEnd := SourceStart;
Value:='';
end;
@ -5489,8 +5457,6 @@ begin
with SrcEdit.EditorComponent do begin
TopLine:=NewTopLine;
LogicalCaretXY:=NewCaretXY;
BlockBegin:=NewCaretXY;
BlockEnd:=NewCaretXY;
end;
end;
end;
@ -6278,7 +6244,7 @@ begin
if FActiveEdit <> nil then
begin
if FActiveEdit.ReadOnly then Exit;
FActiveEdit.EditorComponent.SelText := C;
FActiveEdit.EditorComponent.InsertTextAtCaret(C);
end;
end;