mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 01:30:35 +02:00
On exit ask for changes to save if one file open in two windows.
This commit is contained in:
parent
9146eaf083
commit
31bc7c4054
@ -839,7 +839,7 @@ begin
|
||||
FileName:=P^.Editor^.FileName;
|
||||
if FileName='' then
|
||||
begin
|
||||
P^.Editor^.SaveAsk(true);
|
||||
P^.Editor^.SaveAsk(cmValid,true);
|
||||
FileName:=P^.Editor^.FileName;
|
||||
end;
|
||||
end
|
||||
|
@ -1305,7 +1305,7 @@ begin
|
||||
begin
|
||||
I:=I+ReplacePart(LastWordStart,I-1,'')-1;
|
||||
if W<>nil then
|
||||
if W^.Editor^.SaveAsk(true)=false then
|
||||
if W^.Editor^.SaveAsk(cmValid,true)=false then
|
||||
Err:=-1;
|
||||
end;
|
||||
end else
|
||||
|
@ -1892,7 +1892,7 @@ begin
|
||||
if OK and ({(Command=cmClose) or already handled in TFileEditor.Valid PM }
|
||||
(Command=cmAskSaveAll)) then
|
||||
if IsClipboard=false then
|
||||
OK:=SaveAsk(false);
|
||||
OK:=SaveAsk(Command,false);
|
||||
Valid:=OK;
|
||||
end;
|
||||
|
||||
|
@ -234,7 +234,7 @@ type
|
||||
PScrollBar; AIndicator: PIndicator; ACore: PCodeEditorCore; const AFileName: string);
|
||||
function Save: Boolean; virtual;
|
||||
function SaveAs: Boolean; virtual;
|
||||
function SaveAsk(Force: boolean): Boolean; virtual;
|
||||
function SaveAsk(Command: Word; Force: boolean): boolean; virtual;
|
||||
function LoadFile: boolean; virtual;
|
||||
function ReloadFile: boolean; virtual;
|
||||
function SaveFile: boolean; virtual;
|
||||
@ -265,7 +265,7 @@ implementation
|
||||
|
||||
uses Dos,
|
||||
WConsts,
|
||||
FVConsts,
|
||||
FVConsts,FPConst,
|
||||
App,WViews;
|
||||
|
||||
{$ifndef NOOBJREG}
|
||||
@ -1931,7 +1931,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFileEditor.SaveAsk(Force: boolean): boolean;
|
||||
function TFileEditor.SaveAsk(Command: Word; Force: boolean): boolean;
|
||||
var OK: boolean;
|
||||
D: Sw_integer;
|
||||
begin
|
||||
@ -1946,7 +1946,8 @@ begin
|
||||
begin
|
||||
OK:=(GetModified=false);
|
||||
if (OK=false) and (Core^.GetBindingCount>1) then
|
||||
OK:=true;
|
||||
if (command<>cmAskSaveAll) or (Core^.GetBindingIndex(PCustomCodeEditor(@self))<>0) then
|
||||
OK:=true;
|
||||
if OK=false then
|
||||
begin
|
||||
if FileName = '' then D := edSaveUntitled else D := edSaveModify;
|
||||
@ -2002,7 +2003,7 @@ begin
|
||||
OK:=inherited Valid(Command);
|
||||
if OK and (Command=cmClose) then
|
||||
if IsClipboard=false then
|
||||
OK:=SaveAsk(false);
|
||||
OK:=SaveAsk(Command,false);
|
||||
Valid:=OK;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user