[dev] [dwm] reload configuration?
So, in the early stages of trying out dwm, the thing I'm finding most frustrating is the need to restart after changing config.h. My first attempt was to modify spawn such that if arg-v[0] is dwm, it doesn't fork, just exec's. But, when doing that, all the windows' tag information is lost, so I end up with 50 windows jumbled onto tag 1 on one monitor. Anyone have suggestions? -- Best, Ben
Re: [dev] [dwm] reload configuration?
On 25 March 2011 12:46, Benjamin R. Haskell suckl...@benizi.com wrote: So, in the early stages of trying out dwm, the thing I'm finding most frustrating is the need to restart after changing config.h. My first attempt was to modify spawn such that if arg-v[0] is dwm, it doesn't fork, just exec's. But, when doing that, all the windows' tag information is lost, so I end up with 50 windows jumbled onto tag 1 on one monitor. Anyone have suggestions? Just launch dwm from a while loop in .xinitrc (or launch dwm manually from an xterm as WM): while true do dwm done Cheers, Anselm
Re: [dev] [dwm] reload configuration?
On Fri, 25 Mar 2011, Anselm R Garbe wrote: On 25 March 2011 12:46, Benjamin R. Haskell wrote: So, in the early stages of trying out dwm, the thing I'm finding most frustrating is the need to restart after changing config.h. My first attempt was to modify spawn such that if arg-v[0] is dwm, it doesn't fork, just exec's. But, when doing that, all the windows' tag information is lost, so I end up with 50 windows jumbled onto tag 1 on one monitor. Anyone have suggestions? Just launch dwm from a while loop in .xinitrc (or launch dwm manually from an xterm as WM): while true do dwm done [OT] Where did everyone pick up this shell scripting style with the extra newline? (while x\ndo\n instead of while x ; do\n?) I omitted too many details. One reason I don't do that is that it's not just dwm that I'm doing this for. I'm migrating (possibly/probably) from wmii, so I'd also like to be able to respawn into wmii (or ion3 or ...). I modified spawn() to handle any of those cases by not forking. But beyond that, looping or manually launching dwm doesn't solve the problem that all the tag information is lost between restarts. wmii gets around it by dumping the tag information into X props (still loses layout info, but keeping the tags is far better than dumping everything onto a single tag). Has anyone patched dwm to do something similar? -- Best, Ben
Re: [dev] [dwm] reload configuration?
On 25 March 2011 13:47, Benjamin R. Haskell suckl...@benizi.com wrote: [OT] Where did everyone pick up this shell scripting style with the extra newline? (while x\ndo\n instead of while x ; do\n?) Old plain sh required the newline style (not sure if heirloom sh supports the semicolon list terminator). Of course pdksh or bash support both styles. So just a matter of style. I omitted too many details. One reason I don't do that is that it's not just dwm that I'm doing this for. I'm migrating (possibly/probably) from wmii, so I'd also like to be able to respawn into wmii (or ion3 or ...). I modified spawn() to handle any of those cases by not forking. But beyond that, looping or manually launching dwm doesn't solve the problem that all the tag information is lost between restarts. wmii gets around it by dumping the tag information into X props (still loses layout info, but keeping the tags is far better than dumping everything onto a single tag). Has anyone patched dwm to do something similar? In dwm this is usually done pre-actively through rules, not post-actively through state dumps (another reason why I named dwm dynamic rather than static). Cheers, Anselm
Re: [dev] [dwm] reload configuration?
On Fri, 25 Mar 2011, Anselm R Garbe wrote: On 25 March 2011 13:47, Benjamin R. Haskell wrote: [OT] Where did everyone pick up this shell scripting style with the extra newline? (while x\ndo\n instead of while x ; do\n?) Old plain sh required the newline style (not sure if heirloom sh supports the semicolon list terminator). Of course pdksh or bash support both styles. So just a matter of style. Interesting to know. Thanks. I omitted too many details. One reason I don't do that is that it's not just dwm that I'm doing this for. I'm migrating (possibly/probably) from wmii, so I'd also like to be able to respawn into wmii (or ion3 or ...). I modified spawn() to handle any of those cases by not forking. But beyond that, looping or manually launching dwm doesn't solve the problem that all the tag information is lost between restarts. wmii gets around it by dumping the tag information into X props (still loses layout info, but keeping the tags is far better than dumping everything onto a single tag). Has anyone patched dwm to do something similar? In dwm this is usually done pre-actively through rules, not post-actively through state dumps Huh. Okay. In the same way that wmii was a departure for me from normal/mainstream wm's I guess I just have to get used to the local idioms. (another reason why I named dwm dynamic rather than static). Seems slightly backwards to me (static set of rules, rather than dynamically-assigned set of tags). But I can see what you mean. I'll stop trying to drive my nail in with a screwdriver, so to speak. -- Thanks much, Ben
Re: [dev] [svkbd] Touchtyping made easier.
Hi thanks for your work zwanni ;) 2011/3/24 Christoph Lohmann 2...@r-36.net: Hello comrades, attached is some strange form of mercurial communication patch bomb, which they call a »bundle«. This one includes 15 change- sets, which will increase your svkbd experience. Changes: * The basic window variables wh, ww, wx and wy are exported to the configuration file. Moved this back to svkbd.c. Instead I improved the algorithm for calculating the windows height. If your experience problems with this approach, I'll consider moving it back to config.def.h * Layouts now reside in the »layouts» directory. You can simply do »make clean; LAYOUT=de make« and it will compile the now included German layout. Good idea. I changed this a little bit. use make svkbd.en, make svkbd.de, make svkbc.arrows to compile (make defaults to layout.en.h). * Rectangle drawing has been fixed. Now the rectanges are com- pletely drawn. thx, applied. * There are now commandline options for setting the basic win- dow variables on the commandline. This is useful, when the basic layout is set to be at the bottom, but the keyboard should be above your dwm status bar. applied in a simplified way. * I have added the arrow layout, which was proposed some time ago on the mailinglist. applied. More ideas: * Svkbd should have a rectangle (key), which will move svkbd, when it is pressed and held. That rectangle could be used for minimizing it somehow to a small one row line, which will maxime it again, when you press it. There should be a key for quitting it too. * In wide screen mode decrease the client space, when svkbd is open. (Solely a dwm change.) managing svkbd window should be the window managers job. I added a switch in config.def.h (wmborder) to decide if it should be managed by the wm or not. Personally, I prefer a even simpler approach: opening svkbd in hardcoded window geometry an let the wm care about the rest. Call me lazy, I don't care :P In the long term I would love to see X11 dying anyway. ;) regards Enno
[dev] [surf] browser identification
Hi, imbeciles coding sucking webpages check how the browser identifies itself. And if it is not sucking browser instead of desired content I get some ad about downloading sucking software. All I can check is for example aruljohn.com which tells me Your browser is Unknown Browser. At the same time luakit results with Mozilla 5.0 while jumanji with Safari 5.0. But I am too blind to find anything relevant in their codes. How can I patch surf to identify as one of those? Thanks, s.
[dev] [surf] arrows
Do the arrows are intend to be useful with surf? I experience strange behaviour. First hit takes me to the the top or bottom of the page. Then they allow me to scroll. Is it a bug or a feature? I did try to define bindings in the config file, but then it messes with desired behaviour in pages with forms. Is there a reason (not) to bind home/end buttons? s.
Re: [dev] [surf] browser identification
I believe you simply need to set a SURF_USERAGENT env variable? L. On Fri, Mar 25, 2011 at 3:15 PM, Swiatoslaw Gal swiatoslaw@univie.ac.at wrote: Hi, imbeciles coding sucking webpages check how the browser identifies itself. And if it is not sucking browser instead of desired content I get some ad about downloading sucking software. All I can check is for example aruljohn.com which tells me Your browser is Unknown Browser. At the same time luakit results with Mozilla 5.0 while jumanji with Safari 5.0. But I am too blind to find anything relevant in their codes. How can I patch surf to identify as one of those? Thanks, s.
Re: [dev] [surf] arrows
On Fri, Mar 25, 2011 at 04:19:40PM +0100, Swiatoslaw Gal wrote: Do the arrows are intend to be useful with surf? I experience strange behaviour. First hit takes me to the the top or bottom of the page. Then they allow me to scroll. Is it a bug or a feature? I did try to define bindings in the config file, but then it messes with desired behaviour in pages with forms. Is there a reason (not) to bind home/end buttons? This is a known mess in surf. Or I should say a conceptual mess, a mess that, as far as I can tell, only implementing modes would fix. On the one hand, you might be tempted to bind Up/Down to replace C-j and C-k. Then the strange behaviour won't occur, of course. But *then* if you try to use Up/Down in a textarea box it won't be treated as an Up/Down but a C-j/C-k. Which is (I think) more annoying than the original annoyance. The solution is to train yourself to never hit Up/Down and rather aim your fingers at C-j/C-k. PgUp/PgDown work fine, fwiw. I'd be happy to hear of someone who has a quick-n-dirty solution to this problem. Peter -- sic dicit magister P PhD Candidate Collaborative Programme in Ancient and Medieval Philosophy University of Toronto http://individual.utoronto.ca/peterjh
Re: [dev] [surf] arrows
On Fri, Mar 25, 2011 at 12:11:50PM -0400, Peter John Hartman wrote: The solution is to train yourself to never hit Up/Down and rather aim your fingers at C-j/C-k. PgUp/PgDown work fine, fwiw. I'd be happy to hear of someone who has a quick-n-dirty solution to this problem. The solution is to turn off spatial navigation.
Re: [dev] [surf] arrows
On Fri, Mar 25, 2011 at 12:28:55PM -0400, Josh Rickmar wrote: The solution is to turn off spatial navigation. Huh? -- sic dicit magister P PhD Candidate Collaborative Programme in Ancient and Medieval Philosophy University of Toronto http://individual.utoronto.ca/peterjh
Re: [dev] [surf] arrows
On Fri, Mar 25, 2011 at 12:30:52PM -0400, Peter John Hartman wrote: On Fri, Mar 25, 2011 at 12:28:55PM -0400, Josh Rickmar wrote: The solution is to turn off spatial navigation. Huh? diff -r 7a931a352cf9 surf.c --- a/surf.cThu Sep 09 11:15:02 2010 +0200 +++ b/surf.cFri Mar 25 12:36:10 2011 -0400 @@ -501,7 +501,7 @@ g_object_set(G_OBJECT(settings), auto-load-images, loadimage, NULL); g_object_set(G_OBJECT(settings), enable-plugins, plugin, NULL); g_object_set(G_OBJECT(settings), enable-scripts, script, NULL); - g_object_set(G_OBJECT(settings), enable-spatial-navigation, true, NULL); + g_object_set(G_OBJECT(settings), enable-spatial-navigation, false, NULL); g_free(uri);
Re: [dev] [svkbd] Touchtyping made easier.
For virtual keyboards i think they only take sense if yhey are located at the bottom of the screen. The window manager should preserve this space for the keyboard.. So, like a tiled window in the bottom of the focused monitor. On panoranic screens the width can be unnecesarily big.. But it takes no sense to use the virtual keyboard in 16:9 screens.. What about a fixed width and a proportional or fixed height? Like 30% of screen height? Which kind of uses you do with it? If we add support for virtual keyboards on dwm.. We should add it for desktop panels.. Because they relay on the same concepts. On 25/03/2011, at 15:22, Enno Boland (Gottox) got...@gmail.com wrote: Hi thanks for your work zwanni ;) 2011/3/24 Christoph Lohmann 2...@r-36.net: Hello comrades, attached is some strange form of mercurial communication patch bomb, which they call a »bundle«. This one includes 15 change- sets, which will increase your svkbd experience. Changes: * The basic window variables wh, ww, wx and wy are exported to the configuration file. Moved this back to svkbd.c. Instead I improved the algorithm for calculating the windows height. If your experience problems with this approach, I'll consider moving it back to config.def.h * Layouts now reside in the »layouts» directory. You can simply do »make clean; LAYOUT=de make« and it will compile the now included German layout. Good idea. I changed this a little bit. use make svkbd.en, make svkbd.de, make svkbc.arrows to compile (make defaults to layout.en.h). * Rectangle drawing has been fixed. Now the rectanges are com- pletely drawn. thx, applied. * There are now commandline options for setting the basic win- dow variables on the commandline. This is useful, when the basic layout is set to be at the bottom, but the keyboard should be above your dwm status bar. applied in a simplified way. * I have added the arrow layout, which was proposed some time ago on the mailinglist. applied. More ideas: * Svkbd should have a rectangle (key), which will move svkbd, when it is pressed and held. That rectangle could be used for minimizing it somehow to a small one row line, which will maxime it again, when you press it. There should be a key for quitting it too. * In wide screen mode decrease the client space, when svkbd is open. (Solely a dwm change.) managing svkbd window should be the window managers job. I added a switch in config.def.h (wmborder) to decide if it should be managed by the wm or not. Personally, I prefer a even simpler approach: opening svkbd in hardcoded window geometry an let the wm care about the rest. Call me lazy, I don't care :P In the long term I would love to see X11 dying anyway. ;) regards Enno
Re: [dev] [surf] arrows
The solution is to turn off spatial navigation. Spatial navigation is not that bad. But, the annoying bug/feature is that the _first_ hit down brings me to the last link. Can this be avoided? Does anyone has a patch to bin toggling spatial navigation to some key? s.
[dev] [dvtm] a series of patches
I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross
Re: [dev] [dvtm] a series of patches
1. support for compiling under AIX On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -41,7 +41,7 @@ #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) # include util.h #endif -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) || defined(_AIX) # include alloca.h #endif @@ -1306,6 +1348,10 @@ t-bell = !t-bell; } +#ifdef _AIX +# include forkpty-aix.c +#endif + pid_t madtty_forkpty(madtty_t *t, const char *p, const char *argv[], const char *env[], int *pty) { struct winsize ws; Index: config.h === --- config.h(.../vendor/current)(revision 47) +++ config.h(.../trunk) (revision 47) @@ -53,7 +59,7 @@ { [ ], fullscreen }, }; -#define MOD CTRL('g') +#define MOD CONTROL('g') /* you can at most specifiy MAX_ARGS (2) number of arguments */ Key keys[] = { Index: dvtm.c === --- dvtm.c (.../vendor/current)(revision 47) +++ dvtm.c (.../trunk) (revision 47) @@ -13,7 +13,11 @@ #define _GNU_SOURCE #include sys/stat.h #include sys/ioctl.h -#include sys/fcntl.h +#ifdef _AIX +# include fcntl.h +#else +# include sys/fcntl.h +#endif #include sys/wait.h #include sys/time.h #include sys/types.h @@ -57,10 +61,15 @@ Client *prev; }; #define ALT(k) ((k) + (161 - 'a')) -#ifndef CTRL - #define CTRL(k) ((k) 0x1F) -#endif +#define CONTROL(k) ((k) 0x1F) #define CTRL_ALT(k) ((k) + (129 - 'a')) #define MAX_ARGS 2 @@ -568,7 +578,8 @@ static void lock(const char *args[]) { size_t len = 0, i = 0; - char buf[16], *pass = buf, c; + char buf[16], *pass = buf; + int c; erase(); curs_set(0); @@ -966,13 +996,14 @@ keypress(int code) { Client *c; int len = 1; + int x; char buf[8] = { '\e' }; if (code == '\e') { /* pass characters following escape to the underlying app */ nodelay(stdscr, TRUE); - while (len sizeof(buf) - 1 (buf[len] = getch()) != ERR) - len++; + while (len sizeof(buf) - 1 (x = getch()) != ERR) + buf[len++] = x; buf[len] = '\0'; nodelay(stdscr, FALSE); } Index: forkpty-aix.c === --- forkpty-aix.c (.../vendor/current)(revision 0) +++ forkpty-aix.c (.../trunk) (revision 47) @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2009 Nicholas Marriott n...@users.sourceforge.net + * Copyright (c) 2011 Ross Palmer Mohn rpm...@waxandwane.org + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU
Re: [dev] [dvtm] a series of patches
2. support the 8 basic highlighted colors, plus a couple of color_hash fixes On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -54,8 +54,8 @@ #define IS_CONTROL(ch) !((ch) 0xff60UL) static int has_default, is_utf8, use_palette; -static const unsigned palette_start = 1; -static const unsigned palette_end = 256; +#define palette_start 1 +#define palette_end 512 static unsigned palette_cur; static short *color2palette; @@ -415,8 +419,14 @@ case 49: t-curbg = -1; break; + case 90 ... 97: /* hi fg */ +t-curfg = param[i] - 82; +break; + case 100 ... 107: /*hi bg */ +t-curbg = param[i] - 92; +break; default: break; } @@ -1439,7 +1492,7 @@ static unsigned color_hash(short f, short b) { - return ((f+1) * (COLORS+1)) + b + 1; + return ((f+1) * COLORS) + b + 1; } void madtty_color_set(WINDOW *win, short fg, short bg) @@ -1488,8 +1541,8 @@ color2palette = calloc((COLORS+1)*(COLORS+1), sizeof(short)); int bg = 0, fg = 0; for (int i = palette_start; i palette_end; i++) { -init_pair(i, bg, fg); -color2palette[color_hash(bg, fg)] = i; +init_pair(i, fg, bg); +color2palette[color_hash(fg, bg)] = i; if (++fg == COLORS) { fg = 0; bg++;
Re: [dev] [dvtm] a series of patches
4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -179,17 +179,19 @@ }; static void madtty_process_nonprinting(madtty_t *t, wchar_t wc); +static void send_curs(madtty_t *t); __attribute__((const)) static uint16_t build_attrs(unsigned curattrs) { @@ -729,6 +742,9 @@ case 'u': /* restore cursor location */ restore_curs(t); break; + case 'n': +if (param_count == 1 csiparam[0] == 6) /* query cursor location */ +send_curs(t); default: break; } @@ -1361,6 +1407,13 @@ } } +static void send_curs(madtty_t *t) +{ +char keyseq[16]; +sprintf(keyseq, \e[%d;%dR, (int)(t-curs_row - t-lines), t-curs_col); +term_write(t, keyseq, strlen(keyseq)); +} + void madtty_keypress(madtty_t *t, int keycode) { char c = (char)keycode;
Re: [dev] [dvtm] a series of patches
5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -105,8 +105,8 @@ /* geometry */ int rows, cols, maxcols; -unsigned curattrs, savattrs; -short curfg, curbg, savfg, savbg; +unsigned curattrs, savattrs, dfltattrs; +short curfg, curbg, savfg, savbg, dfltfg, dfltbg; /* scrollback buffer */ struct t_row_t *scroll_buf; @@ -197,13 +199,13 @@ NCURSES_ATTR_SHIFT; } -static void t_row_set(t_row_t *row, int start, int len, madtty_t *t) +static void t_row_set(t_row_t *row, int start, int len, madtty_t *t, bool dfltcolor) { row-dirty = true; wmemset(row-text + start, 0, len); -attr_t attr = t ? build_attrs(t-curattrs) : 0; -short fg = t ? t-curfg : -1; -short bg = t ? t-curbg : -1; +attr_t attr = build_attrs(dfltcolor ? t-dfltattrs : t-curattrs); +short fg = dfltcolor ? t-dfltfg : t-curfg; +short bg = dfltcolor ? t-dfltbg : t-curbg; for (int i = start; i len + start; i++) { row-attr[i] = attr; row-fg [i] = fg; @@ -316,7 +318,7 @@ static void cursor_line_down(madtty_t *t) { -t_row_set(t-curs_row, t-cols, t-maxcols - t-cols, 0); +t_row_set(t-curs_row, t-cols, t-maxcols - t-cols, t, 1); t-curs_row++; if (t-curs_row t-scroll_bot) return; @@ -325,7 +327,7 @@ t-curs_row = t-scroll_bot - 1; fill_scroll_buf(t, 1); -t_row_set(t-curs_row, 0, t-cols, t); +t_row_set(t-curs_row, 0, t-cols, t, 0); } static void new_escape_sequence(madtty_t *t) @@ -354,16 +356,18 @@ { if (pcount == 0) { /* special case: reset attributes */ -t-curattrs = A_NORMAL; -t-curfg = t-curbg = -1; +t-curattrs = t-dfltattrs; +t-curfg = t-dfltfg; +t-curbg = t-dfltbg; return; } for (int i = 0; i pcount; i++) { switch (param[i]) { case 0: -t-curattrs = A_NORMAL; -t-curfg = t-curbg = -1; +t-curattrs = t-dfltattrs; +t-curfg = t-dfltfg; +t-curbg = t-dfltbg; break; case 1: t-curattrs |= A_BOLD; @@ -404,7 +408,7 @@ i += 2; break; case 39: -t-curfg = -1; +t-curfg = t-dfltfg; break; case 40 ... 47: /* bg */ t-curbg = param[i] - 40; @@ -415,8 +419,14 @@ i += 2; break; case 49: -t-curbg = -1; +t-curbg = t-dfltbg; break; case 90 ... 97: /* hi fg */ t-curfg = param[i] - 82; @@ -429,8 +439,9 @@ t_row_t *row, *start, *end; save_attrs(t); -t-curattrs = A_NORMAL; -t-curfg = t-curbg = -1; +t-curattrs = t-dfltattrs; +t-curfg = t-dfltfg; +t-curbg = t-dfltbg; /* decide range */ if (pcount param[0] == 2) { @@ -439,15 +450,15 @@ } else if (pcount param[0] == 1) { start = t-lines; end = t-curs_row; -t_row_set(t-curs_row, 0, t-curs_col + 1, t); +t_row_set(t-curs_row, 0, t-curs_col + 1, t, 0); } else { -t_row_set(t-curs_row, t-curs_col, t-cols - t-curs_col, t); +t_row_set(t-curs_row, t-curs_col, t-cols - t-curs_col, t, 0); start = t-curs_row + 1; end = t-lines + t-rows; } for (row = start; row end; row++) -t_row_set(row, 0, t-cols, t); +t_row_set(row, 0, t-cols, t, 0); restore_attrs(t); } @@ -495,13 +506,13 @@ { switch (pcount ? param[0] : 0) { case 1: -t_row_set(t-curs_row, 0, t-curs_col + 1, t); +t_row_set(t-curs_row, 0, t-curs_col + 1, t, 0); break; case 2: -t_row_set(t-curs_row, 0, t-cols, t); +t_row_set(t-curs_row, 0, t-cols, t, 0); break; default: -t_row_set(t-curs_row, t-curs_col,
Re: [dev] [dvtm] a series of patches
6. support to backfill text from the buffer when a windows is resized with more rows On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -1153,7 +1178,7 @@ if (t-rows != rows) { if (t-curs_row lines+rows) { /* scroll up instead of simply chopping off bottom */ -fill_scroll_buf(t, t-rows - rows); +fill_scroll_buf(t, (t-curs_row - t-lines) - rows + 1); } while (t-rows rows) { free(lines[t-rows - 1].text); @@ -1190,13 +1215,23 @@ t-cols = cols; } -while (t-rows rows) { -lines[t-rows].text = (wchar_t *)calloc(sizeof(wchar_t), t-maxcols); -lines[t-rows].attr = (uint16_t *)calloc(sizeof(uint16_t), t-maxcols); -lines[t-rows].fg = calloc(sizeof(short), t-maxcols); -lines[t-rows].bg = calloc(sizeof(short), t-maxcols); -t_row_set(lines + t-rows, 0, t-maxcols, 0); -t-rows++; +int deltarows = 0; +if (t-rows rows) { +while (t-rows rows) { +lines[t-rows].text = (wchar_t *)calloc(sizeof(wchar_t), t-maxcols); +lines[t-rows].attr = (uint16_t *)calloc(sizeof(uint16_t), t-maxcols); +lines[t-rows].fg = calloc(sizeof(short), t-maxcols); +lines[t-rows].bg = calloc(sizeof(short), t-maxcols); +t_row_set(lines + t-rows, 0, t-maxcols, t, 1); +t-rows++; +} + +/* Prepare for backfill */ +if (t-curs_row = t-scroll_bot - 1) { +deltarows = t-lines + rows - t-curs_row - 1; +if (deltarows t-scroll_buf_len) +deltarows = t-scroll_buf_len; +} } t-curs_row += lines - t-lines; @@ -1204,6 +1239,13 @@ t-scroll_bot = lines + rows; t-lines = lines; clamp_cursor_to_bounds(t); + +/* Perform backfill */ +if (deltarows 0) { +fill_scroll_buf(t, -deltarows); +t-curs_row += deltarows; +} + ioctl(t-pty, TIOCSWINSZ, ws); kill(-t-childpid, SIGWINCH); }
Re: [dev] [dvtm] a series of patches
I forgot to mention: the reason I increased the number of palette_end is because with many colors, such as with some of the vttest scripts, the color_pairs begin to overwrite each other. With 256 I was certainly getting some funky color shifts because of this! I just doubled it to 512, but I think 384 is likely sufficient if you want to save memory. -Ross On 03/25/2011 10:30 PM, Ross Mohn wrote: 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross
Re: [dev] [dvtm] a series of patches
3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() On 03/25/2011 10:25 PM, Ross Mohn wrote: I'm going to post a series of 6 patches for dvtm over the next several minutes. They all apply to the current HEAD of the dvtm git repository (committed 2011-01-07). I think I've teased them all apart pretty well so that each one is separate and complete. 1. support for compiling under AIX 2. support the 8 basic highlighted colors, plus a couple of color_hash fixes 3. fix a scrolling issue and add in ESC # to call interpret_esc_SCS() 4. support for ESC 6 n, get cursor position, which calls a new function, send_curs() 5. support colorrules[] to match strings against window titles, applycolorrules(), and call madtty_set_dflt_colors() 6. support to backfill text from the buffer when a windows is resized with more rows Comments, testing, and bugfixes sincerely welcome! Cheers! -Ross Index: madtty.c === --- madtty.c(.../vendor/current)(revision 47) +++ madtty.c(.../trunk) (revision 47) @@ -457,7 +468,7 @@ { if (pcount == 0) { /* special case */ -t-curs_row = t-lines; +t-curs_row = (t-relposmode ? t-scroll_top : t-lines); t-curs_col = 0; } else if (pcount == 1) { t-curs_row = (t-relposmode ? t-scroll_top : t-lines) + param[0] - 1; @@ -790,6 +806,7 @@ switch (*t-ebuf) { case '(': case ')': + case '#': if (t-elen == 2) { interpret_esc_SCS(t); cancel_escape_sequence(t);