From e8e615a9b127d27cba2d2ee3d89def0ce5ed716b Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 7 Jun 2008 00:39:15 +0000 Subject: [PATCH] synedit: implemented non UTF-8 characters are shown as ? git-svn-id: trunk@15347 - --- components/synedit/synedit.pp | 33 +++++++++++++++++++++++++-------- lcl/lconvencoding.pas | 7 ++++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 3130d77cad..7c79d833f4 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -3267,9 +3267,9 @@ var procedure ExpandSpecialChars(var p: PChar; var Count: integer; PhysicalStartPos: integer); - // if there are no tabs: keep p and Count untouched - // if there are tabs: copy p into ExpandedPaintToken buffer, - // convert tabs to spaces, and return the buffer + // if there are no tabs or special chars: keep p and Count untouched + // if there are special chars: copy p into ExpandedPaintToken buffer, + // convert tabs to spaces, and return the buffer var i: integer; TabCount, LengthNeeded: Integer; @@ -3284,8 +3284,10 @@ var TabCount:=0; for i:=0 to Count-1 do if p[i]=#9 then inc(TabCount); - if TabCount=0 then exit; - LengthNeeded:=Count+TabCount*8; + if (TabCount=0) + and (FindInvalidUTF8Character(p,Count)<0) then + exit; + LengthNeeded:=Count+TabCount*TabWidth; if length(ExpandedPaintToken)