aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--boxes.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/boxes.c b/boxes.c
index d9b39b7..42446f3 100644
--- a/boxes.c
+++ b/boxes.c
@@ -1868,17 +1868,11 @@ void handle_keys(long extra, int (*handle_sequence)(long extra, char *sequence))
1868 fd_set selectFds; 1868 fd_set selectFds;
1869 struct timespec timeout; 1869 struct timespec timeout;
1870 sigset_t signalMask; 1870 sigset_t signalMask;
1871 1871 char buffer[20], sequence[20];
1872 // Get the initial command set.
1873 char buffer[20], sequence[20], csFinal[8];
1874 int buffIndex = 0; 1872 int buffIndex = 0;
1875// TODO - multiline editLine is an advanced feature. Editing boxes just moves the editLine up and down.
1876// uint16_t h = 1;
1877// TODO - should check if it's at the top of the box, then grow it down instead of up if so.
1878 1873
1879 buffer[0] = 0; 1874 buffer[0] = 0;
1880 sequence[0] = 0; 1875 sequence[0] = 0;
1881
1882 sigemptyset(&signalMask); 1876 sigemptyset(&signalMask);
1883 sigaddset(&signalMask, SIGWINCH); 1877 sigaddset(&signalMask, SIGWINCH);
1884 1878
@@ -1900,7 +1894,7 @@ void handle_keys(long extra, int (*handle_sequence)(long extra, char *sequence))
1900 if (sigWinch) 1894 if (sigWinch)
1901 { 1895 {
1902 // Send - save cursor position, down 999, right 999, request cursor position, restore cursor position. 1896 // Send - save cursor position, down 999, right 999, request cursor position, restore cursor position.
1903 printf("\x1B[s\x1B[999C\x1B[999B\x1B[6n\x1B[u"); 1897 fputs("\x1B[s\x1B[999C\x1B[999B\x1B[6n\x1B[u", stdout);
1904 fflush(stdout); 1898 fflush(stdout);
1905 sigWinch = 0; 1899 sigWinch = 0;
1906 } 1900 }
@@ -2006,7 +2000,7 @@ void handle_keys(long extra, int (*handle_sequence)(long extra, char *sequence))
2006TODO So abort the current CSI and start from scratch. 2000TODO So abort the current CSI and start from scratch.
2007 */ 2001 */
2008 2002
2009 char *t; 2003 char *t, csFinal[8];
2010 int csIndex = 1, csParams[8]; 2004 int csIndex = 1, csParams[8];
2011 2005
2012 csFinal[0] = 0; 2006 csFinal[0] = 0;
@@ -2845,14 +2839,14 @@ void boxes_main(void)
2845 // http://rtfm.etla.org/xterm/ctlseq.html documents xterm stuff, near the bottom is the mouse stuff. 2839 // http://rtfm.etla.org/xterm/ctlseq.html documents xterm stuff, near the bottom is the mouse stuff.
2846 // http://leonerds-code.blogspot.co.uk/2012/04/wide-mouse-support-in-libvterm.html is helpful. 2840 // http://leonerds-code.blogspot.co.uk/2012/04/wide-mouse-support-in-libvterm.html is helpful.
2847 // Enable mouse (VT200 normal tracking mode, UTF8 encoding). The limit is 2015. Seems to only be in later xterms. 2841 // Enable mouse (VT200 normal tracking mode, UTF8 encoding). The limit is 2015. Seems to only be in later xterms.
2848// printf("\x1B[?1005h"); 2842// fputs("\x1B[?1005h", stdout);
2849 // Enable mouse (VT340 locator reporting mode). In theory has no limit. Wont actually work though. 2843 // Enable mouse (VT340 locator reporting mode). In theory has no limit. Wont actually work though.
2850 // On the other hand, only allows for four buttons, so only half a mouse wheel. 2844 // On the other hand, only allows for four buttons, so only half a mouse wheel.
2851 // Responds with "\1B[e;p;r;c;p&w" where e is event type, p is a bitmap of buttons pressed, r and c are the mouse coords in decimal, and p is the "page number". 2845 // Responds with "\1B[e;p;r;c;p&w" where e is event type, p is a bitmap of buttons pressed, r and c are the mouse coords in decimal, and p is the "page number".
2852// printf("\x1B[1;2'z\x1B[1;3'{"); 2846// fputs("\x1B[1;2'z\x1B[1;3'{", stdout);
2853 // Enable mouse (VT200 normal tracking mode). Has a limit of 256 - 32 rows and columns. An xterm exclusive I think, but works in roxterm at least. No wheel reports. 2847 // Enable mouse (VT200 normal tracking mode). Has a limit of 256 - 32 rows and columns. An xterm exclusive I think, but works in roxterm at least. No wheel reports.
2854 // Responds with "\x1B[Mbxy" where x and y are the mouse coords, and b is bit encoded buttons and modifiers - 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release, 4=Shift, 8=Meta, 16=Control 2848 // Responds with "\x1B[Mbxy" where x and y are the mouse coords, and b is bit encoded buttons and modifiers - 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release, 4=Shift, 8=Meta, 16=Control
2855 printf("\x1B[?1000h"); 2849 fputs("\x1B[?1000h", stdout);
2856 fflush(stdout); 2850 fflush(stdout);
2857 2851
2858 calcBoxes(currentBox); 2852 calcBoxes(currentBox);
@@ -2870,6 +2864,6 @@ void boxes_main(void)
2870 // Restore the old terminal settings. 2864 // Restore the old terminal settings.
2871 tcsetattr(0, TCSANOW, &oldtermio); 2865 tcsetattr(0, TCSANOW, &oldtermio);
2872 2866
2873 puts("\n"); 2867 puts("");
2874 fflush(stdout); 2868 fflush(stdout);
2875} 2869}