Add terminal query responses for BBS ANSI detection
Handle ENQ (0x05), ESC[c (Device Attributes), ESC[5n (Device Status Report), and ESC[6n (Cursor Position Report). Responses are sent back through OnKeyData so BBSes can detect ANSI terminal capability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c3ae983a73
commit
a3c52e0817
2 changed files with 31 additions and 0 deletions
|
|
@ -639,6 +639,28 @@ begin
|
|||
FSaveCurRow := FCursorRow;
|
||||
FSaveCurCol := FCursorCol;
|
||||
end;
|
||||
'c': { DA - Device Attributes }
|
||||
begin
|
||||
{ Respond as VT100 with no options }
|
||||
if Assigned(FOnKeyData) then
|
||||
FOnKeyData(Self, #27'[?1;0c');
|
||||
end;
|
||||
'n': { DSR - Device Status Report }
|
||||
begin
|
||||
if P1 = 5 then
|
||||
begin
|
||||
{ Terminal status: report OK }
|
||||
if Assigned(FOnKeyData) then
|
||||
FOnKeyData(Self, #27'[0n');
|
||||
end
|
||||
else if P1 = 6 then
|
||||
begin
|
||||
{ Cursor Position Report: respond with ESC[row;colR (1-based) }
|
||||
if Assigned(FOnKeyData) then
|
||||
FOnKeyData(Self, #27'[' + IntToStr(FCursorRow + 1) + ';' +
|
||||
IntToStr(FCursorCol + 1) + 'R');
|
||||
end;
|
||||
end;
|
||||
'u': { RCP - Restore Cursor Position }
|
||||
begin
|
||||
FCursorRow := FSaveCurRow;
|
||||
|
|
@ -1201,6 +1223,11 @@ begin
|
|||
TabCol := FCols - 1;
|
||||
FCursorCol := TabCol;
|
||||
end;
|
||||
#5: { ENQ - Answerback }
|
||||
begin
|
||||
if Assigned(FOnKeyData) then
|
||||
FOnKeyData(Self, #27'[?1;0c');
|
||||
end;
|
||||
#7: { BEL }
|
||||
MessageBeep(0);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ CSI (ESC\[) sequences:
|
|||
| ESC\[*params*m | SGR | Set graphic rendition (see below) |
|
||||
| ESC\[s | SCP | Save cursor position |
|
||||
| ESC\[u | RCP | Restore cursor position |
|
||||
| ESC\[c | DA | Device Attributes — responds ESC\[?1;0c (VT100) |
|
||||
| ESC\[5n | DSR | Device Status Report — responds ESC\[0n (OK) |
|
||||
| ESC\[6n | CPR | Cursor Position Report — responds ESC\[*row*;*col*R |
|
||||
|
||||
SGR codes:
|
||||
|
||||
|
|
@ -148,6 +151,7 @@ Control characters:
|
|||
| LF (#10) | Line feed (scrolls at bottom) |
|
||||
| BS (#8) | Backspace (no erase) |
|
||||
| TAB (#9) | Tab to next 8-column stop |
|
||||
| ENQ (#5) | Answerback — responds ESC\[?1;0c (VT100) |
|
||||
| BEL (#7) | System beep |
|
||||
|
||||
**ANSI Music:**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue