mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:39:18 +02:00
SynEdit: Fix WantTabs / Change default to "True" Issue #0021904
git-svn-id: trunk@37133 -
This commit is contained in:
parent
e870b21355
commit
3cb8b0d420
@ -447,6 +447,8 @@ type
|
|||||||
//procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
|
//procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
|
||||||
procedure WMSetFocus(var Msg: TLMSetFocus); message WM_SETFOCUS;
|
procedure WMSetFocus(var Msg: TLMSetFocus); message WM_SETFOCUS;
|
||||||
procedure WMVScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_VSCROLL;
|
procedure WMVScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_VSCROLL;
|
||||||
|
protected
|
||||||
|
procedure CMWantSpecialKey(var Message: TLMessage); message CM_WANTSPECIALKEY;
|
||||||
private
|
private
|
||||||
FBlockIndent: integer;
|
FBlockIndent: integer;
|
||||||
FBlockTabIndent: integer;
|
FBlockTabIndent: integer;
|
||||||
@ -1114,7 +1116,7 @@ type
|
|||||||
property BracketHighlightStyle: TSynEditBracketHighlightStyle
|
property BracketHighlightStyle: TSynEditBracketHighlightStyle
|
||||||
read GetBracketHighlightStyle write SetBracketHighlightStyle;
|
read GetBracketHighlightStyle write SetBracketHighlightStyle;
|
||||||
property TabWidth: integer read fTabWidth write SetTabWidth default 8;
|
property TabWidth: integer read fTabWidth write SetTabWidth default 8;
|
||||||
property WantTabs: boolean read fWantTabs write SetWantTabs default FALSE;
|
property WantTabs: boolean read fWantTabs write SetWantTabs default True;
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||||
@ -2046,7 +2048,7 @@ begin
|
|||||||
FMouseActionSearchHandlerList := TSynEditMouseActionSearchList.Create;
|
FMouseActionSearchHandlerList := TSynEditMouseActionSearchList.Create;
|
||||||
FMouseActionExecHandlerList := TSynEditMouseActionExecList.Create;
|
FMouseActionExecHandlerList := TSynEditMouseActionExecList.Create;
|
||||||
|
|
||||||
fWantTabs := False;
|
fWantTabs := True;
|
||||||
fTabWidth := 8;
|
fTabWidth := 8;
|
||||||
FOldTopView := 1;
|
FOldTopView := 1;
|
||||||
FFoldedLinesView.TopLine := 1;
|
FFoldedLinesView.TopLine := 1;
|
||||||
@ -2630,6 +2632,11 @@ begin
|
|||||||
DebugLn('[TCustomSynEdit.KeyDown] ',dbgs(Key),' ',dbgs(Shift));
|
DebugLn('[TCustomSynEdit.KeyDown] ',dbgs(Key),' ',dbgs(Shift));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
if (not WantTabs) and (Key = VK_TAB) and ((Shift - [ssShift]) = []) then begin
|
||||||
|
inherited KeyDown(Key, Shift);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
// Run even before OnKeyDown
|
// Run even before OnKeyDown
|
||||||
if FKeyDownEventList <> nil then
|
if FKeyDownEventList <> nil then
|
||||||
FKeyDownEventList.CallKeyDownHandlers(Self, Key, Shift);
|
FKeyDownEventList.CallKeyDownHandlers(Self, Key, Shift);
|
||||||
@ -4563,6 +4570,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.CMWantSpecialKey(var Message: TLMessage);
|
||||||
|
begin
|
||||||
|
if (Message.wParam = VK_TAB) then begin
|
||||||
|
if WantTabs then
|
||||||
|
Message.Result := 1
|
||||||
|
else
|
||||||
|
Message.Result := 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
inherited CMWantSpecialKey(Message);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.ScanRanges(ATextChanged: Boolean = True);
|
procedure TCustomSynEdit.ScanRanges(ATextChanged: Boolean = True);
|
||||||
begin
|
begin
|
||||||
if not HandleAllocated then begin
|
if not HandleAllocated then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user