Skip to content

Commit 3c1a5a2

Browse files
authored
Merge branch 'doublecmd:master' into master
2 parents 1ea1720 + 1d4f994 commit 3c1a5a2

141 files changed

Lines changed: 5537 additions & 579 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# The new package will be saved here
4+
PACK_DIR=$PWD/doublecmd-release
5+
6+
# Temp dir for creating *.tar.xz package
7+
BUILD_PACK_DIR=/var/tmp/doublecmd-$(date +%y.%m.%d)
8+
9+
# Save revision number
10+
DC_REVISION=$(install/linux/update-revision.sh ./ ./)
11+
12+
# Read version number
13+
DC_MAJOR=$(grep 'MajorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+')
14+
DC_MINOR=$(grep 'MinorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
15+
DC_MICRO=$(grep 'RevisionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
16+
DC_VER=$DC_MAJOR.$DC_MINOR.$DC_MICRO
17+
18+
# Get libraries
19+
pushd install
20+
wget https://github.com/doublecmd/external/raw/main/linux.tar.gz
21+
tar xzf linux.tar.gz
22+
rm -f linux.tar.gz
23+
popd
24+
25+
# Set widgetset
26+
export lcl=gtk3
27+
28+
# Set processor architecture
29+
export CPU_TARGET=$(fpc -iTP)
30+
31+
build_doublecmd()
32+
{
33+
# Build all components of Double Commander
34+
./build.sh release
35+
36+
# Copy libraries
37+
cp -a install/linux/lib/$CPU_TARGET/*.so ./
38+
39+
# Create *.tar.xz package
40+
mkdir -p $BUILD_PACK_DIR
41+
install/linux/install.sh --portable-prefix=$BUILD_PACK_DIR
42+
pushd $BUILD_PACK_DIR
43+
# Set run-time library search path
44+
patchelf --set-rpath '$ORIGIN' doublecmd/doublecmd
45+
tar -cJf $PACK_DIR/doublecmd-$DC_VER-$DC_REVISION.$lcl.$CPU_TARGET.tar.xz doublecmd
46+
popd
47+
48+
# Clean DC build dir
49+
./clean.sh
50+
rm -rf $BUILD_PACK_DIR
51+
}
52+
53+
mkdir -p $PACK_DIR
54+
55+
build_doublecmd

.github/workflows/snapshots.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,50 @@ jobs:
106106
overwrite: true
107107
file_glob: true
108108

109+
build-lin:
110+
needs: build-win
111+
runs-on: ubuntu-22.04
112+
environment: snapshots
113+
steps:
114+
- name: Install dependencies
115+
run: sudo apt install fpc patchelf libgtk-3-dev libdbus-1-dev
116+
117+
- name: Get Lazarus source
118+
uses: actions/checkout@v6
119+
with:
120+
repository: 'fpc/Lazarus'
121+
122+
- name: Build and install Lazarus
123+
run: |
124+
make all
125+
sudo make install
126+
127+
- name: Create Lazarus config
128+
run: |
129+
sudo mkdir -p /etc/lazarus
130+
sudo cp tools/install/linux/environmentoptions.xml /etc/lazarus/environmentoptions.xml
131+
sudo sed -i -e "s|__LAZARUSDIR__|/usr/local/share/lazarus|g" /etc/lazarus/environmentoptions.xml
132+
133+
- name: Checkout source
134+
uses: actions/checkout@v6
135+
with:
136+
fetch-depth: 0
137+
138+
- name: Build packages
139+
run: ./.github/scripts/create_snapshot.lnx
140+
141+
- name: Save revision number
142+
run: echo "REVISION=$(git rev-list --count HEAD)" >> "$GITHUB_ENV"
143+
shell: bash
144+
145+
- name: Upload binaries to snapshots
146+
uses: svenstaro/upload-release-action@v2
147+
with:
148+
repo_name: doublecmd/snapshots
149+
repo_token: ${{ secrets.SNAPSHOTS }}
150+
file: doublecmd-release/doublecmd*.tar.xz
151+
release_name: Revision ${{ env.REVISION }}
152+
tag: ${{ env.REVISION }}
153+
body: ${{ vars.BODY }}
154+
overwrite: true
155+
file_glob: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*.w?x
1717
units/
1818
/doublecmd
19+
tools/extractdwrflnfo
1920

2021
# Lazarus autogenerated files (duplicated info)
2122
*.rst

components/doublecmd/dcclassesutf8.pas

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
interface
2929

3030
uses
31-
Classes, RtlConsts, SysUtils, IniFiles;
31+
Classes, RtlConsts, SysUtils, IniFiles, Math;
3232

3333
type
3434
{ TFileStreamEx class }
@@ -53,7 +53,7 @@ TFileStreamEx = class(THandleStream)
5353
property AutoSync: Boolean read FAutoSync write SetAutoSync;
5454
property Capacity: Int64 write SetCapacity;
5555
property FileName: String read FFileName;
56-
end;
56+
end;
5757

5858
{ TStringListEx }
5959

@@ -64,7 +64,7 @@ TStringListEx = class(TStringList)
6464
function IndexOfValue(const Value: String): Integer;
6565
procedure LoadFromFile(const FileName: String); override;
6666
procedure SaveToFile(const FileName: String); override;
67-
end;
67+
end;
6868

6969
{ TIniFileEx }
7070

@@ -82,7 +82,7 @@ TIniFileEx = class(TMemIniFile)
8282
implementation
8383

8484
uses
85-
DCOSUtils, LazUTF8;
85+
DCOSUtils, DCConvertEncoding;
8686

8787
{ TFileStreamEx }
8888

@@ -175,7 +175,7 @@ constructor TFileStreamEx.Create(const AFileName: String; Mode: LongWord);
175175
inherited Create(AHandle);
176176
end
177177
else
178-
begin
178+
begin
179179
AHandle:= mbFileOpen(AFileName, Mode);
180180
if AHandle = feInvalidHandle then
181181
raise EFOpenError.CreateFmt(SFOpenError + LineEnding + mbSysErrorMessage , [AFilename])
@@ -213,11 +213,26 @@ function TFileStreamEx.Write(const Buffer; Count: LongInt): LongInt;
213213
{ TStringListEx }
214214

215215
function TStringListEx.DoCompareText(const S1, S2: String): PtrInt;
216+
var
217+
U1, U2: UnicodeString;
216218
begin
219+
U1:= CeUtf8ToUtf16(S1);
220+
U2:= CeUtf8ToUtf16(S2);
221+
217222
if CaseSensitive then
218-
Result:= UTF8CompareStr(S1, S2)
223+
begin
224+
Result:= UnicodeCompareStr(U1, U2);
225+
if Result = 0 then
226+
begin
227+
Result := CompareMemRange(Pointer(U1), Pointer(U2), Min(Length(U1), Length(U2)) * SizeOf(WideChar));
228+
if Result = 0 then
229+
Result := Length(U1) - Length(U2);
230+
end
231+
end
219232
else
220-
Result:= UTF8CompareText(S1, S2);
233+
begin
234+
Result:= UnicodeCompareText(U1, U2);
235+
end;
221236
end;
222237

223238
function TStringListEx.IndexOfValue(const Value: String): Integer;

components/doublecmd/dcstrutils.pas

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ function TrimPath(const Path: String): String;
247247
}
248248
function TrimRightLineEnding(const sText: String; TextLineBreakStyle: TTextLineBreakStyle): String;
249249
function mbCompareText(const s1, s2: String): PtrInt;
250+
function mbCompareStr(const s1, s2: String): PtrInt;
250251

251252
function StrNewW(const mbString: String): PWideChar;
252253
procedure StrDisposeW(var pStr : PWideChar);
@@ -1024,9 +1025,12 @@ function TrimRightLineEnding(const sText: String; TextLineBreakStyle: TTextLineB
10241025

10251026
function mbCompareText(const s1, s2: String): PtrInt; inline;
10261027
begin
1027-
// From 0.9.31 LazUtils can be used but this package does not exist in 0.9.30.
1028-
// Result := LazUTF8.UTF8CompareText(s1, s2);
1029-
Result := WideCompareText(CeUtf8ToUtf16(s1), CeUtf8ToUtf16(s2));
1028+
Result := UnicodeCompareText(CeUtf8ToUtf16(s1), CeUtf8ToUtf16(s2));
1029+
end;
1030+
1031+
function mbCompareStr(const s1, s2: String): PtrInt; inline;
1032+
begin
1033+
Result := UnicodeCompareStr(CeUtf8ToUtf16(s1), CeUtf8ToUtf16(s2));
10301034
end;
10311035

10321036
function StrNewW(const mbString: String): PWideChar;

components/doublecmd/dcunix.pas

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,11 @@ function fnmatch(const pattern: PAnsiChar; const str: PAnsiChar; flags: cint): c
286286
implementation
287287

288288
uses
289-
Unix, DCConvertEncoding, LazUTF8
289+
Unix, DCConvertEncoding, DCOSUtils, LazUTF8
290290
{$IF DEFINED(DARWIN)}
291291
, DCDarwin
292292
{$ELSEIF DEFINED(LINUX)}
293-
, Dos, DCLinux, DCOSUtils
294-
{$ELSEIF DEFINED(FREEBSD)}
295-
, DCOSUtils
293+
, Dos, DCLinux
296294
{$ENDIF}
297295
;
298296

@@ -495,21 +493,22 @@ function FindMountPointPath(const FileName: String): String;
495493
begin
496494
if (I = 1) then
497495
sTemp:= PathDelim
498-
else
496+
else begin
499497
sTemp:= Copy(FileName, 1, I - 1);
498+
end;
500499
// Stat for current directory
501500
if (fpLStat(sTemp, recStat) < 0) then Continue;
502501
// If it is a link then checking link destination
503502
if fpS_ISLNK(recStat.st_mode) then
504503
begin
505-
sTemp:= fpReadlink(sTemp);
504+
sTemp:= mbReadAllLinks(sTemp);
506505
Result:= FindMountPointPath(sTemp);
507506
Exit;
508507
end;
509508
// Check device ID
510509
if (recStat.st_dev <> st_dev) then
511510
begin
512-
Result:= Copy(FileName, 1, J);
511+
Result:= IncludeTrailingPathDelimiter(Copy(FileName, 1, J));
513512
Exit;
514513
end;
515514
J:= I;

components/synunihighlighter/source/SynUniHighlighter.pas

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,20 @@ procedure TSynUniSyn.ResetRange;
446446

447447
procedure TSynUniSyn.SetRange(Value: Pointer);
448448
//: Set current range
449+
{$if lcl_fullversion >= 4990000}
450+
var
451+
Index: Integer;
452+
{$endif}
449453
begin
454+
{$if lcl_fullversion >= 4990000}
455+
// Workaround, issue #2764
456+
if (Value = nil) then
457+
begin
458+
Index:= LineIndex - 1;
459+
PrepareLines(-1, 100);
460+
Value:= CurrentRanges[Index];
461+
end;
462+
{$endif}
450463
fCurrentRule := TSynRange(Value);
451464
end;
452465

0 commit comments

Comments
 (0)