Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat DEL(\x7f) as a control character #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions VT100Terminal.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@

@implementation VT100Terminal

#define iscontrol(c) ((c) <= 0x1f)
#define iscontrol(c) ((c) <= 0x1f || (c) == 0x7f)
#define isprintable_ascii(c) ((c) > 0x1f && (c) < 0x7f)

/*
Traditional Chinese (Big5)
Expand Down Expand Up @@ -2222,7 +2223,7 @@ static VT100TCC decode_ascii_string(unsigned char *datap,
int len = datalen;

while (len > 0) {
if (*p >= 0x20 && *p <= 0x7f) {
if (isprintable_ascii(*p)) {
p++;
len--;
} else {
Expand Down Expand Up @@ -2668,11 +2669,11 @@ - (VT100TCC)getNextToken
}
} else {
int rmlen = 0;
if (*datap >= 0x20 && *datap <= 0x7f) {
if (isprintable_ascii(*datap)) {
result = decode_ascii_string(datap, datalen, &rmlen);
result.length = rmlen;
result.position = datap;
} else if (iscontrol(datap[0])) {
} else if (iscontrol(*datap)) {
result = decode_control(datap, datalen, &rmlen, ENCODING, SCREEN, useCanonicalParser);
result.length = rmlen;
result.position = datap;
Expand Down