mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: In viewer, show in the title collapsed filename (fixes #164)
This commit is contained in:
parent
9a2ffad84e
commit
056efc6fa8
3 changed files with 24 additions and 3 deletions
|
|
@ -585,7 +585,7 @@ begin
|
|||
Exit;
|
||||
|
||||
FFileName := AValue;
|
||||
Caption := FFileName;
|
||||
Caption := ReplaceHome(FFileName);
|
||||
end;
|
||||
|
||||
destructor TfrmEditor.Destroy;
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ var
|
|||
dwFileAttributes: TFileAttrs;
|
||||
begin
|
||||
FLastSearchPos := -1;
|
||||
Caption := aFileName;
|
||||
Caption := ReplaceHome(aFileName);
|
||||
ViewerControl.FileName := EmptyStr;
|
||||
|
||||
// Clear text on status bar.
|
||||
|
|
@ -751,7 +751,7 @@ begin
|
|||
begin
|
||||
Status.Panels[sbpFileNr].Text:= Format('%d/%d', [Index + 1, FileList.Count]);
|
||||
Status.Panels[sbpFileName].Text:= FileList[Index];
|
||||
Caption:= FileList[Index];
|
||||
Caption:= ReplaceHome(FileList[Index]);
|
||||
iActiveFile := Index;
|
||||
Exit;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ function SetCmdDirAsEnvVar(const sPath : String) : String;
|
|||
Also replaces the internal "%COMMANDER_PATH%".
|
||||
}
|
||||
function ReplaceEnvVars(const sText: String): String;
|
||||
{en
|
||||
Replaces home directory at the beginning of the string with tilde ~.
|
||||
}
|
||||
function ReplaceHome(const Path: String): String;
|
||||
{en
|
||||
Replaces tilde ~ at the beginning of the string with home directory.
|
||||
}
|
||||
|
|
@ -317,6 +321,23 @@ begin
|
|||
Result:= mbExpandEnvironmentStrings(Result);
|
||||
end;
|
||||
|
||||
function ReplaceHome(const Path: String): String;
|
||||
{$IFDEF UNIX}
|
||||
var
|
||||
Len: Integer;
|
||||
AHome: String;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF UNIX}
|
||||
AHome:= GetHomeDir;
|
||||
Len:= Length(AHome);
|
||||
if StrBegins(Path, AHome) and ((Length(Path) = Len) or (Path[Len + 1] = PathDelim)) then
|
||||
Result := '~' + Copy(Path, Len + 1, MaxInt)
|
||||
else
|
||||
{$ENDIF}
|
||||
Result := Path;
|
||||
end;
|
||||
|
||||
function ReplaceTilde(const Path: String): String;
|
||||
begin
|
||||
{$IFDEF UNIX}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue