parent
287e1b7d89
commit
dce0557be3
|
|
@ -1772,7 +1772,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
autosetgtwidth();
|
autosetgtwidth();
|
||||||
return DoTextChanged(p);
|
return DoTextChanged(p);
|
||||||
end
|
end
|
||||||
function setcurrentLineColor(c);
|
function setcurrentLineColor(c);
|
||||||
begin
|
begin
|
||||||
if ifnumber(c) and c<>fcurrentLineColor then
|
if ifnumber(c) and c<>fcurrentLineColor then
|
||||||
begin
|
begin
|
||||||
|
|
@ -2218,47 +2218,10 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
end
|
end
|
||||||
function GetSelText();
|
function GetSelText();
|
||||||
begin
|
begin
|
||||||
r := "";
|
if not GetSelAvail()then return "";
|
||||||
if not GetSelAvail()then return r;
|
|
||||||
bb := GetBlockBegin();
|
bb := GetBlockBegin();
|
||||||
ee := GetBlockEnd();
|
ee := GetBlockEnd();
|
||||||
if FSelectionMode=smLine then
|
return buffer_getchars(bb,ee,FSelectionMode);
|
||||||
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;
|
|
||||||
end
|
end
|
||||||
function SetCaretX(cx);
|
function SetCaretX(cx);
|
||||||
begin
|
begin
|
||||||
|
|
@ -2442,7 +2405,53 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
end
|
end
|
||||||
FHasFocus;
|
FHasFocus;
|
||||||
//buffer ´¦Àí
|
//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
|
begin
|
||||||
if bb=ee then return;
|
if bb=ee then return;
|
||||||
if bb[0]=ee[0]then //ɾ³ýÒ»ÐÐÖеÄ
|
if bb[0]=ee[0]then //ɾ³ýÒ»ÐÐÖеÄ
|
||||||
|
|
@ -2463,7 +2472,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
fLines.splices(bb[0],ee[0]-bb[0],array());
|
fLines.splices(bb[0],ee[0]-bb[0],array());
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function buffer_InsertChars(cxy,str); //插入
|
function buffer_InsertChars(cxy,str,sm); //插入
|
||||||
begin
|
begin
|
||||||
if not(ifstring(str)and str)then return;
|
if not(ifstring(str)and str)then return;
|
||||||
ss := str2array(str,"\n");
|
ss := str2array(str,"\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue