Ticket #501: terminal_patch.txt

File terminal_patch.txt, 1.3 KB (added by korli, 18 years ago)

fix to set window title

Line 
1Index: TermParse.cpp
2===================================================================
3--- TermParse.cpp (revision 17231)
4+++ TermParse.cpp (working copy)
5@@ -6,6 +6,7 @@
6 */
7
8
9+#include <ctype.h>
10 #include <errno.h>
11 #include <stdio.h>
12 #include <signal.h>
13@@ -776,10 +777,38 @@
14 break;
15
16 case CASE_OSC:
17+ {
18 /* Operating System Command: ESC ] */
19- // do_osc(finput);
20+ char string[512];
21+ int len = 0;
22+ char mode_char = theObj->GetReaderBuf();
23+ if (mode_char != '0'
24+ && mode_char != '1'
25+ && mode_char != '2') {
26+ parsestate = groundtable;
27+ break;
28+ }
29+ char current_char = theObj->GetReaderBuf();
30+ while ((current_char = theObj->GetReaderBuf()) != 0x7) {
31+ if (!isprint(current_char & 0x7f)
32+ || len+2 >= sizeof(string))
33+ break;
34+ string[len++] = current_char;
35+ }
36+ if (current_char == 0x7) {
37+ string[len] = '\0';
38+ switch (mode_char) {
39+ case '0':
40+ case '2':
41+ theObj->fWinObj->SetTitle(string);
42+ break;
43+ case '1':
44+ break;
45+ }
46+ }
47 parsestate = groundtable;
48 break;
49+ }
50
51 case CASE_RIS: // ESC c ... Reset terminal.
52 break;