Update utslmemo.tsf

修正中文符号选取问题
This commit is contained in:
JianjunLiu 2023-09-05 09:39:44 +08:00
parent f317fb4c0c
commit 28e5c5b476
1 changed files with 41 additions and 8 deletions

View File

@ -1672,12 +1672,12 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
ci++;
break;
end }
if ivi=0xa1 or ivi=0xa3 then //处理中文符号
begin
if if_c_sym(s,cx,ls,lx) then //处理中文符号
begin
cx++;
ci--;
break;
end
break;
end
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then
begin
ci++;
@ -1705,9 +1705,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
//ivi := ord(vi);
ivi := getchar(s,cx);
//if (ivi<=0x2f) or (ivi>122 and ivi<=127) then break;
if ivi=0xa1 or ivi=0xa3 then //处理中文符号
begin
break;
if if_c_sym(s,cx,ls) then //处理中文符号
begin
break;
end
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then break;
ci++;
@ -3045,13 +3045,21 @@ type TSynHighLighter = class(TComponent) //
begin
SetTToken(tks,ctk,idx-1);
end else
if if_c_sym(s,idx,len) then
begin
SetTToken(tks,ctk,idx-1);
ctk := s[idx:(idx+1)];
idx++;
SetTToken(tks,ctk,idx);
end
{else
if idx<len and( ord(vi)=0xa3 or ord(vi)=0xa1) then
begin
SetTToken(tks,ctk,idx-1);
ctk := s[idx:(idx+1)];
idx++;
SetTToken(tks,ctk,idx);
end
end }
else
begin
ctk+=vi;
@ -4301,6 +4309,31 @@ type TSynMemoNorm = class(TsynCustomMemo) //
FSheetTabFlage;
end
Implementation
function if_c_sym(s,idx,len,lx);//是否为中文符号
begin
if lx then //倒序
begin
if not(idx<=len) then return 0;
if idx<2 then return 0;
c1 := getchar(s,idx-1);
if not(c1 .& 0xa0) then return 0;
c2 := getchar(s,idx);
end else //正序
begin
if not(idx<len ) then return 0;
c1 := getchar(s,idx);
if not(c1 .& 0xa0) then return 0;
c2 := getchar(s,idx+1);
end
symv := static array(161,162,163,161,163,164,163,168,163,169,161,164,161,190,161,191,163,186,161,176,161,177,161,174,163,187,161,163,163,172);
for i:=0 to length(symv)-1 step 2 do
begin
if c1=symv[i] and c2=symv[i+1] then
begin
return 1;
end
end
end
function CreateATslMemoUndoItem(AReason,AStart,AEnd,ChangeText,SelMode);
begin