parent
287e1b7d89
commit
dce0557be3
|
|
@ -1772,7 +1772,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
autosetgtwidth();
|
||||
return DoTextChanged(p);
|
||||
end
|
||||
function setcurrentLineColor(c);
|
||||
function setcurrentLineColor(c);
|
||||
begin
|
||||
if ifnumber(c) and c<>fcurrentLineColor then
|
||||
begin
|
||||
|
|
@ -2218,47 +2218,10 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
end
|
||||
function GetSelText();
|
||||
begin
|
||||
r := "";
|
||||
if not GetSelAvail()then return r;
|
||||
if not GetSelAvail()then return "";
|
||||
bb := GetBlockBegin();
|
||||
ee := GetBlockEnd();
|
||||
if FSelectionMode=smLine then
|
||||
begin
|
||||
len := ee[0];
|
||||
for i := bb[0]to ee[0] do
|
||||
begin
|
||||
r += fLines[i-1].FStr;
|
||||
if i<len then r += "\r\n";
|
||||
end
|
||||
end else
|
||||
begin
|
||||
if bb[0]=ee[0]then
|
||||
begin
|
||||
s := fLines[bb[0]-1].FStr;
|
||||
if ee[1]>bb[1]and ee[1]>1 then
|
||||
try
|
||||
r := s[bb[1]:ee[1]-1]; //可能出错,添加try
|
||||
except
|
||||
r := "";
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
//第一行
|
||||
s := fLines[bb[0]-1].FStr;
|
||||
if bb[1]<= length(s)then r += s[bb[1]:];
|
||||
r += "\r\n";
|
||||
//中间
|
||||
for i := bb[0]to ee[0]-2 do
|
||||
begin
|
||||
r += fLines[i].FStr;
|
||||
r += "\r\n";
|
||||
end
|
||||
//最后一行
|
||||
s := fLines[ee[0]-1].FStr;
|
||||
if s and ee[1]>1 then r += s[1:ee[1]-1];
|
||||
end
|
||||
end
|
||||
return r;
|
||||
return buffer_getchars(bb,ee,FSelectionMode);
|
||||
end
|
||||
function SetCaretX(cx);
|
||||
begin
|
||||
|
|
@ -2442,11 +2405,57 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
end
|
||||
FHasFocus;
|
||||
//buffer ´¦Àí
|
||||
function buffer_DeleteChars(bb,ee); //删除选择
|
||||
function buffer_getchars(bb,ee,sm);
|
||||
begin
|
||||
r := "";
|
||||
if sm=smLine then
|
||||
begin
|
||||
len := ee[0];
|
||||
for i := bb[0]to ee[0] do
|
||||
begin
|
||||
r += fLines[i-1].FStr;
|
||||
if i<len then r += "\r\n";
|
||||
end
|
||||
end else
|
||||
begin
|
||||
if bb[0]=ee[0]then
|
||||
begin
|
||||
s := fLines[bb[0]-1].FStr;
|
||||
if not s then return "";
|
||||
bg := min(bb[1],ee[1]);
|
||||
ed := max(bb[1],ee[1]);
|
||||
if bg<ed then return s[bg:(ed-1)];
|
||||
return "";
|
||||
{if ee[1]>bb[1]and ee[1]>1 then
|
||||
try
|
||||
r := s[bb[1]:ee[1]-1]; //可能出错,添加try
|
||||
except
|
||||
r := "";
|
||||
end;}
|
||||
end else
|
||||
begin
|
||||
//第一行
|
||||
s := fLines[bb[0]-1].FStr;
|
||||
if bb[1]<= length(s)then r += s[bb[1]:];
|
||||
r += "\r\n";
|
||||
//中间
|
||||
for i := bb[0]to ee[0]-2 do
|
||||
begin
|
||||
r += fLines[i].FStr;
|
||||
r += "\r\n";
|
||||
end
|
||||
//最后一行
|
||||
s := fLines[ee[0]-1].FStr;
|
||||
if s and ee[1]>1 then r += s[1:ee[1]-1];
|
||||
end
|
||||
end
|
||||
return r;
|
||||
end
|
||||
function buffer_DeleteChars(bb,ee,sm); //删除选择
|
||||
begin
|
||||
if bb=ee then return;
|
||||
if bb[0]=ee[0]then //ɾ³ýÒ»ÐÐÖеÄ
|
||||
begin
|
||||
begin
|
||||
str := fLines.GetStringByIndex(bb[0]-1);
|
||||
str[bb[1]:ee[1]-1]:= "";
|
||||
fLines.SetValueByIndex(bb[0]-1,str);
|
||||
|
|
@ -2463,7 +2472,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
fLines.splices(bb[0],ee[0]-bb[0],array());
|
||||
end
|
||||
end
|
||||
function buffer_InsertChars(cxy,str); //插入
|
||||
function buffer_InsertChars(cxy,str,sm); //插入
|
||||
begin
|
||||
if not(ifstring(str)and str)then return;
|
||||
ss := str2array(str,"\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue