|
@@ -202,7 +202,6 @@ end;
|
|
|
|
|
|
procedure LinuxClipBoardData;
|
|
procedure LinuxClipBoardData;
|
|
var zt,rt : AnsiString;
|
|
var zt,rt : AnsiString;
|
|
- st : ShortString;
|
|
|
|
escSeq : ShortString;
|
|
escSeq : ShortString;
|
|
inEsc,inRead : boolean;
|
|
inEsc,inRead : boolean;
|
|
k : sw_integer;
|
|
k : sw_integer;
|
|
@@ -210,7 +209,6 @@ var zt,rt : AnsiString;
|
|
timewait,finalparsec : TimeSpec;
|
|
timewait,finalparsec : TimeSpec;
|
|
ree:longint;
|
|
ree:longint;
|
|
countemptines : sw_integer;
|
|
countemptines : sw_integer;
|
|
- l : sw_integer;
|
|
|
|
rlen : longint;
|
|
rlen : longint;
|
|
begin
|
|
begin
|
|
countemptines:=0;
|
|
countemptines:=0;
|
|
@@ -222,26 +220,21 @@ begin
|
|
while inRead do
|
|
while inRead do
|
|
begin
|
|
begin
|
|
if keypressed then
|
|
if keypressed then
|
|
- st:=RawReadString
|
|
|
|
|
|
+ ch:=RawReadKey
|
|
else
|
|
else
|
|
- st:='';
|
|
|
|
- if length(st)=0 then
|
|
|
|
begin
|
|
begin
|
|
inc(countemptines);
|
|
inc(countemptines);
|
|
- if countemptines = 3 then break;
|
|
|
|
|
|
+ if countemptines = 30 then break;
|
|
{we might be ahead for a shortwhile, wait a little bit longer}
|
|
{we might be ahead for a shortwhile, wait a little bit longer}
|
|
timewait.tv_sec := 0;
|
|
timewait.tv_sec := 0;
|
|
- timewait.tv_nsec := 20000000;
|
|
|
|
|
|
+ timewait.tv_nsec := 2000000;
|
|
ree:=fpNanoSleep(@timewait,@finalparsec);
|
|
ree:=fpNanoSleep(@timewait,@finalparsec);
|
|
continue;
|
|
continue;
|
|
end;
|
|
end;
|
|
countemptines:=0;
|
|
countemptines:=0;
|
|
- if st[1]=';' then
|
|
|
|
- st:=copy(st,2,length(st));
|
|
|
|
- for k:=1 to length(st) do
|
|
|
|
- begin
|
|
|
|
- ch:=st[k];
|
|
|
|
- if inEsc then
|
|
|
|
|
|
+ if ch = ';' then
|
|
|
|
+ continue; {ment to eat very first ';', there shoud not be any other}
|
|
|
|
+ if inEsc then
|
|
begin
|
|
begin
|
|
escSeq:=escSeq+ch;
|
|
escSeq:=escSeq+ch;
|
|
if ch = '\' then
|
|
if ch = '\' then
|
|
@@ -251,19 +244,19 @@ begin
|
|
break;
|
|
break;
|
|
end;
|
|
end;
|
|
{we should not reach this point}
|
|
{we should not reach this point}
|
|
- continue;
|
|
|
|
|
|
+ {unless OSC 52 is spliced by other escape sequence}
|
|
|
|
+ break;
|
|
end;
|
|
end;
|
|
- if ch = #27 then
|
|
|
|
- inEsc:=true
|
|
|
|
- else if ch <> #7 then
|
|
|
|
- zt:=zt+ch {base64 encoded data in}
|
|
|
|
- else
|
|
|
|
|
|
+ if ch = #27 then
|
|
|
|
+ inEsc:=true
|
|
|
|
+ else if ch <> #7 then
|
|
|
|
+ zt:=zt+ch {base64 encoded data in}
|
|
|
|
+ else
|
|
begin
|
|
begin
|
|
{data end, xterm terminal}
|
|
{data end, xterm terminal}
|
|
inRead:=false;
|
|
inRead:=false;
|
|
break;
|
|
break;
|
|
end;
|
|
end;
|
|
- end; {for..}
|
|
|
|
end; {while do }
|
|
end; {while do }
|
|
if length(zt)=0 then exit;
|
|
if length(zt)=0 then exit;
|
|
{-- data decode --}
|
|
{-- data decode --}
|
|
@@ -276,13 +269,12 @@ end;
|
|
|
|
|
|
procedure BracketedPaste;
|
|
procedure BracketedPaste;
|
|
var zt : AnsiString;
|
|
var zt : AnsiString;
|
|
- st : ShortString;
|
|
|
|
k : sw_integer;
|
|
k : sw_integer;
|
|
ch : AnsiChar;
|
|
ch : AnsiChar;
|
|
timewait,finalparsec : TimeSpec;
|
|
timewait,finalparsec : TimeSpec;
|
|
ree:longint;
|
|
ree:longint;
|
|
countemptines : sw_integer;
|
|
countemptines : sw_integer;
|
|
- l : sw_integer;
|
|
|
|
|
|
+ len : sw_integer;
|
|
begin
|
|
begin
|
|
countemptines:=0;
|
|
countemptines:=0;
|
|
zt:='';
|
|
zt:='';
|
|
@@ -290,42 +282,34 @@ begin
|
|
while true do
|
|
while true do
|
|
begin
|
|
begin
|
|
if keypressed then
|
|
if keypressed then
|
|
- st:=RawReadString
|
|
|
|
|
|
+ ch:=RawReadKey
|
|
else
|
|
else
|
|
- st:='';
|
|
|
|
- if length(st)=0 then
|
|
|
|
begin
|
|
begin
|
|
inc(countemptines);
|
|
inc(countemptines);
|
|
- if countemptines = 3 then break;
|
|
|
|
|
|
+ if countemptines = 30 then break;
|
|
{we might be ahead for a shortwhile, wait a little bit longer}
|
|
{we might be ahead for a shortwhile, wait a little bit longer}
|
|
timewait.tv_sec := 0;
|
|
timewait.tv_sec := 0;
|
|
- timewait.tv_nsec := 20000000;
|
|
|
|
|
|
+ timewait.tv_nsec := 2000000;
|
|
ree:=fpNanoSleep(@timewait,@finalparsec);
|
|
ree:=fpNanoSleep(@timewait,@finalparsec);
|
|
continue;
|
|
continue;
|
|
end;
|
|
end;
|
|
countemptines:=0;
|
|
countemptines:=0;
|
|
- for k:=1 to length(st) do
|
|
|
|
- begin
|
|
|
|
- ch:=st[k];
|
|
|
|
- if ch <> '~' then
|
|
|
|
- zt:=zt+ch {data in}
|
|
|
|
- else
|
|
|
|
|
|
+ zt:=zt+ch; {data in}
|
|
|
|
+ if ch = '~' then
|
|
begin
|
|
begin
|
|
{test for terminator string}
|
|
{test for terminator string}
|
|
if copy(zt,length(zt)-5,6)=#27'[201~' then
|
|
if copy(zt,length(zt)-5,6)=#27'[201~' then
|
|
break;
|
|
break;
|
|
- zt:=zt+ch; {data in}
|
|
|
|
end;
|
|
end;
|
|
- end; {for..}
|
|
|
|
end; {while do }
|
|
end; {while do }
|
|
- if length(zt)=0 then exit;
|
|
|
|
- l:=length(zt);
|
|
|
|
- if length(zt)>6 then
|
|
|
|
|
|
+ len:=length(zt);
|
|
|
|
+ if len=0 then exit;
|
|
|
|
+ if len>6 then
|
|
begin
|
|
begin
|
|
- l:=length(zt)-6;
|
|
|
|
- SetLength(zt,l); {get rid of bracketed paste end sequence}
|
|
|
|
|
|
+ len:=length(zt)-6;
|
|
|
|
+ SetLength(zt,len); {get rid of bracketed paste end sequence}
|
|
end;
|
|
end;
|
|
- PutInEventQue(zt,l);
|
|
|
|
|
|
+ PutInEventQue(zt,len);
|
|
end;
|
|
end;
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|