mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
Fix terminal sync state bleeding across tabs in per-tab mode
Store the terminal sync mode (TermSyncMode) per tab in TFileViewPage rather than relying purely on the global variables gTermSyncModeLeft and gTermSyncModeRight. This ensures that switching tabs correctly restores the sync state for the newly active tab.
This commit is contained in:
parent
863aeba1ba
commit
5feee14aaf
2 changed files with 33 additions and 1 deletions
|
|
@ -1004,6 +1004,9 @@ uses
|
|||
{$ENDIF}
|
||||
{$IFDEF DARWIN}
|
||||
, uCocoaModernFormConfig
|
||||
{$ENDIF}
|
||||
{$IF DEFINED(UNIX) and not DEFINED(DARWIN)}
|
||||
, BaseUnix
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -5897,6 +5900,15 @@ begin
|
|||
if IsLeft then gTermSyncModeLeft := 0 else gTermSyncModeRight := 0;
|
||||
end;
|
||||
|
||||
// In per-tab mode, persist the sync state to the active page
|
||||
if gTermWindowMode = twmPerTab then
|
||||
begin
|
||||
if IsLeft and Assigned(nbLeft.ActivePage) then
|
||||
TFileViewPage(nbLeft.ActivePage).TermSyncMode := gTermSyncModeLeft
|
||||
else if (not IsLeft) and Assigned(nbRight.ActivePage) then
|
||||
TFileViewPage(nbRight.ActivePage).TermSyncMode := gTermSyncModeRight;
|
||||
end;
|
||||
|
||||
UpdateTermSyncButtons(IsLeft);
|
||||
end;
|
||||
|
||||
|
|
@ -5959,6 +5971,15 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
// In per-tab mode, persist the sync state to the active page
|
||||
if gTermWindowMode = twmPerTab then
|
||||
begin
|
||||
if IsLeft and Assigned(nbLeft.ActivePage) then
|
||||
TFileViewPage(nbLeft.ActivePage).TermSyncMode := gTermSyncModeLeft
|
||||
else if (not IsLeft) and Assigned(nbRight.ActivePage) then
|
||||
TFileViewPage(nbRight.ActivePage).TermSyncMode := gTermSyncModeRight;
|
||||
end;
|
||||
|
||||
UpdateTermSyncButtons(IsLeft);
|
||||
end;
|
||||
|
||||
|
|
@ -6335,10 +6356,18 @@ begin
|
|||
Page.Terminal.Align := alClient;
|
||||
Page.Terminal.Visible := True;
|
||||
|
||||
// Restore per-tab sync mode into the global so UpdateTermSyncButtons
|
||||
// and the timer reflect this tab's state rather than the previous tab's.
|
||||
if Notebook = nbLeft then
|
||||
UpdateTermSyncButtons(True)
|
||||
begin
|
||||
gTermSyncModeLeft := Page.TermSyncMode;
|
||||
UpdateTermSyncButtons(True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
gTermSyncModeRight := Page.TermSyncMode;
|
||||
UpdateTermSyncButtons(False);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.ShowOptionsLayout(Data: PtrInt);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ type
|
|||
FPtyDevice: TCustomPtyDevice;
|
||||
FTermInitialized: Boolean;
|
||||
FTermNeedInit: Boolean;
|
||||
FTermSyncMode: Integer;
|
||||
|
||||
procedure AssignPage(OtherPage: TFileViewPage);
|
||||
procedure AssignProperties(OtherPage: TFileViewPage);
|
||||
|
|
@ -118,6 +119,7 @@ type
|
|||
property PtyDevice: TCustomPtyDevice read FPtyDevice write FPtyDevice;
|
||||
property TermInitialized: Boolean read FTermInitialized write FTermInitialized;
|
||||
property TermNeedInit: Boolean read FTermNeedInit write FTermNeedInit;
|
||||
property TermSyncMode: Integer read FTermSyncMode write FTermSyncMode;
|
||||
end;
|
||||
|
||||
{ TFileViewNotebook }
|
||||
|
|
@ -239,6 +241,7 @@ constructor TFileViewPage.Create(TheOwner: TComponent);
|
|||
begin
|
||||
FLockState := tlsNormal;
|
||||
FBackupViewClass := TColumnsFileView;
|
||||
FTermSyncMode := 0;
|
||||
inherited Create(TheOwner);
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue