mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-26 13:44:24 +00:00
ascii to str
This commit is contained in:
parent
8a7fa9ecb9
commit
8a407192cc
@ -12,7 +12,7 @@ func FormatWritesLog(codes []byte, line *string) {
|
|||||||
codes = nil
|
codes = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sh line prefix
|
// sh control codes
|
||||||
if n >= 6 {
|
if n >= 6 {
|
||||||
if str, exist = ASCIIGroupToStr(fmt.Sprintf("%X", []byte{codes[0], codes[1], codes[n-1]})); exist {
|
if str, exist = ASCIIGroupToStr(fmt.Sprintf("%X", []byte{codes[0], codes[1], codes[n-1]})); exist {
|
||||||
*line += str
|
*line += str
|
||||||
@ -62,6 +62,7 @@ func ASCIIToStr(codes []byte) string {
|
|||||||
29: "GS",
|
29: "GS",
|
||||||
30: "RS",
|
30: "RS",
|
||||||
31: "US",
|
31: "US",
|
||||||
|
32: "SPACE",
|
||||||
127: "DEL",
|
127: "DEL",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ func ASCIIGroupToStr(sum string) (string, bool) {
|
|||||||
"1B5B42": "DOWN",
|
"1B5B42": "DOWN",
|
||||||
"1B5B43": "RIGHT",
|
"1B5B43": "RIGHT",
|
||||||
"1B5B44": "LEFT",
|
"1B5B44": "LEFT",
|
||||||
// sh line prefix: codes[0]codes[1]codes[5]
|
// sh control codes: codes[0]codes[1]codes[5]
|
||||||
// eg. "ESC[ 1;5 R"
|
// eg. "ESC[ 1;5 R"
|
||||||
"1B5B52": "",
|
"1B5B52": "",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user