mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 05:00:25 +02:00
IDE: SpecialCharsToSpaces: trim UTF8 control codes
git-svn-id: trunk@36316 -
This commit is contained in:
parent
074286aea3
commit
281b8cf1da
@ -30,7 +30,7 @@ unit IDEProcs;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LCLProc, AvgLvlTree, Laz2_XMLCfg,
|
||||
Classes, SysUtils, FileUtil, LCLProc, AvgLvlTree, Laz2_XMLCfg, LazUTF8,
|
||||
StdCtrls, ExtCtrls,
|
||||
SourceLog, FileProcs, CodeToolManager, CodeToolsConfig, CodeCache,
|
||||
LazConf;
|
||||
@ -1688,6 +1688,7 @@ var
|
||||
p: LongInt;
|
||||
begin
|
||||
Result:=s;
|
||||
if Result='' then exit;
|
||||
// convert line breaks to single spaces
|
||||
i:=length(Result);
|
||||
while (i>=1) do begin
|
||||
@ -1706,13 +1707,10 @@ begin
|
||||
if Result[i] in [#0..#31,#127] then Result[i]:=' ';
|
||||
if Result='' then exit;
|
||||
if FixUTF8 then begin
|
||||
Result:=copy(Result,1,strlen(PChar(Result)));
|
||||
if Result='' then exit;
|
||||
UniqueString(Result);
|
||||
UTF8FixBroken(PChar(Result));
|
||||
end;
|
||||
if (Result[1]=' ') or (Result[length(Result)]=' ') then
|
||||
Result:=Trim(Result);
|
||||
Result:=UTF8Trim(Result);
|
||||
end;
|
||||
|
||||
function SpecialCharsToHex(const s: string): string;
|
||||
|
Loading…
Reference in New Issue
Block a user