libtermkey-Fix-escape-sequences-for-MSVC.patch 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. diff --git a/t/30mouse.c b/t/30mouse.c
  2. --- a/t/30mouse.c
  3. +++ b/t/30mouse.c
  4. @@ -14,7 +14,7 @@ int main(int argc, char *argv[])
  5. tk = termkey_new_abstract("vt100", 0);
  6. - termkey_push_bytes(tk, "\e[M !!", 6);
  7. + termkey_push_bytes(tk, "\x1b[M !!", 6);
  8. key.type = -1;
  9. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press");
  10. @@ -38,7 +38,7 @@ int main(int argc, char *argv[])
  11. is_int(len, 21, "string length for press");
  12. is_str(buffer, "MousePress(1) @ (1,1)", "string buffer for press");
  13. - termkey_push_bytes(tk, "\e[M@\"!", 6);
  14. + termkey_push_bytes(tk, "\x1b[M@\"!", 6);
  15. key.type = -1;
  16. ev = -1; button = -1; line = -1; col = -1;
  17. @@ -51,7 +51,7 @@ int main(int argc, char *argv[])
  18. is_int(col, 2, "mouse column for drag");
  19. is_int(key.modifiers, 0, "modifiers for press");
  20. - termkey_push_bytes(tk, "\e[M##!", 6);
  21. + termkey_push_bytes(tk, "\x1b[M##!", 6);
  22. key.type = -1;
  23. ev = -1; button = -1; line = -1; col = -1;
  24. @@ -63,7 +63,7 @@ int main(int argc, char *argv[])
  25. is_int(col, 3, "mouse column for release");
  26. is_int(key.modifiers, 0, "modifiers for press");
  27. - termkey_push_bytes(tk, "\e[M0++", 6);
  28. + termkey_push_bytes(tk, "\x1b[M0++", 6);
  29. key.type = -1;
  30. ev = -1; button = -1; line = -1; col = -1;
  31. @@ -81,7 +81,7 @@ int main(int argc, char *argv[])
  32. is_str(buffer, "C-MousePress(1)", "string buffer for Ctrl-press");
  33. // rxvt protocol
  34. - termkey_push_bytes(tk, "\e[0;20;20M", 10);
  35. + termkey_push_bytes(tk, "\x1b[0;20;20M", 10);
  36. key.type = -1;
  37. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press rxvt protocol");
  38. @@ -96,7 +96,7 @@ int main(int argc, char *argv[])
  39. is_int(col, 20, "mouse column for press rxvt protocol");
  40. is_int(key.modifiers, 0, "modifiers for press rxvt protocol");
  41. - termkey_push_bytes(tk, "\e[3;20;20M", 10);
  42. + termkey_push_bytes(tk, "\x1b[3;20;20M", 10);
  43. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse release rxvt protocol");
  44. @@ -111,7 +111,7 @@ int main(int argc, char *argv[])
  45. is_int(key.modifiers, 0, "modifiers for release rxvt protocol");
  46. // SGR protocol
  47. - termkey_push_bytes(tk, "\e[<0;30;30M", 11);
  48. + termkey_push_bytes(tk, "\x1b[<0;30;30M", 11);
  49. key.type = -1;
  50. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press SGR encoding");
  51. @@ -127,7 +127,7 @@ int main(int argc, char *argv[])
  52. is_int(col, 30, "mouse column for press SGR");
  53. is_int(key.modifiers, 0, "modifiers for press SGR");
  54. - termkey_push_bytes(tk, "\e[<0;30;30m", 11);
  55. + termkey_push_bytes(tk, "\x1b[<0;30;30m", 11);
  56. key.type = -1;
  57. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse release SGR encoding");
  58. @@ -139,7 +139,7 @@ int main(int argc, char *argv[])
  59. is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release SGR");
  60. - termkey_push_bytes(tk, "\e[<0;500;300M", 13);
  61. + termkey_push_bytes(tk, "\x1b[<0;500;300M", 13);
  62. key.type = -1;
  63. ev = -1; button = -1; line = -1; col = -1;
  64. diff --git a/t/31position.c b/t/31position.c
  65. index 1748211..86ad1bc 100644
  66. --- a/t/31position.c
  67. +++ b/t/31position.c
  68. @@ -11,7 +11,7 @@ int main(int argc, char *argv[])
  69. tk = termkey_new_abstract("vt100", 0);
  70. - termkey_push_bytes(tk, "\e[?15;7R", 8);
  71. + termkey_push_bytes(tk, "\x1b[?15;7R", 8);
  72. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for position report");
  73. @@ -25,7 +25,7 @@ int main(int argc, char *argv[])
  74. /* A plain CSI R is likely to be <F3> though.
  75. * This is tricky :/
  76. */
  77. - termkey_push_bytes(tk, "\e[R", 3);
  78. + termkey_push_bytes(tk, "\x1b[R", 3);
  79. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for <F3>");
  80. diff --git a/t/32modereport.c b/t/32modereport.c
  81. index 31de400..5e49705 100644
  82. --- a/t/32modereport.c
  83. +++ b/t/32modereport.c
  84. @@ -11,7 +11,7 @@ int main(int argc, char *argv[])
  85. tk = termkey_new_abstract("vt100", 0);
  86. - termkey_push_bytes(tk, "\e[?1;2$y", 8);
  87. + termkey_push_bytes(tk, "\x1b[?1;2$y", 8);
  88. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mode report");
  89. @@ -23,7 +23,7 @@ int main(int argc, char *argv[])
  90. is_int(mode, 1, "mode number from mode report");
  91. is_int(value, 2, "mode value from mode report");
  92. - termkey_push_bytes(tk, "\e[4;1$y", 7);
  93. + termkey_push_bytes(tk, "\x1b[4;1$y", 7);
  94. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mode report");
  95. diff --git a/t/38csi.c b/t/38csi.c
  96. index 9d186f6..fd592d5 100644
  97. --- a/t/38csi.c
  98. +++ b/t/38csi.c
  99. @@ -13,7 +13,7 @@ int main(int argc, char *argv[])
  100. tk = termkey_new_abstract("vt100", 0);
  101. - termkey_push_bytes(tk, "\e[5;25v", 7);
  102. + termkey_push_bytes(tk, "\x1b[5;25v", 7);
  103. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI v");
  104. @@ -26,14 +26,14 @@ int main(int argc, char *argv[])
  105. is_int(args[1], 25, "args[1] for unknown CSI");
  106. is_int(command, 'v', "command for unknown CSI");
  107. - termkey_push_bytes(tk, "\e[?w", 4);
  108. + termkey_push_bytes(tk, "\x1b[?w", 4);
  109. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI ? w");
  110. is_int(key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI");
  111. is_int(termkey_interpret_csi(tk, &key, args, &nargs, &command), TERMKEY_RES_KEY, "interpret_csi yields RES_KEY");
  112. is_int(command, '?'<<8 | 'w', "command for unknown CSI");
  113. - termkey_push_bytes(tk, "\e[?$x", 5);
  114. + termkey_push_bytes(tk, "\x1b[?$x", 5);
  115. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI ? $x");
  116. is_int(key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI");
  117. diff --git a/t/39dcs.c b/t/39dcs.c
  118. index c517411..f065477 100644
  119. --- a/t/39dcs.c
  120. +++ b/t/39dcs.c
  121. @@ -12,7 +12,7 @@ int main(int argc, char *argv[])
  122. tk = termkey_new_abstract("xterm", 0);
  123. // 7bit DCS
  124. - termkey_push_bytes(tk, "\eP1$r1 q\e\\", 10);
  125. + termkey_push_bytes(tk, "\x1bP1$r1 q\x1b\\", 10);
  126. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for DCS");
  127. @@ -38,7 +38,7 @@ int main(int argc, char *argv[])
  128. is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey again yields RES_NONE");
  129. // 7bit OSC
  130. - termkey_push_bytes(tk, "\e]15;abc\e\\", 10);
  131. + termkey_push_bytes(tk, "\x1b]15;abc\x1b\\", 10);
  132. is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for OSC");
  133. @@ -51,7 +51,7 @@ int main(int argc, char *argv[])
  134. is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey again yields RES_NONE");
  135. // False alarm
  136. - termkey_push_bytes(tk, "\eP", 2);
  137. + termkey_push_bytes(tk, "\x1bP", 2);
  138. is_int(termkey_getkey(tk, &key), TERMKEY_RES_AGAIN, "getkey yields RES_AGAIN for false alarm");