[dev] [st] [patch] typedefs instead of #defines

2014-04-05 Thread noname
Replaced #defines with typedefs where possible, patch attached. diff --git a/st.c b/st.c index a4f467d..89e93e0 100644 --- a/st.c +++ b/st.c @@ -36,10 +36,6 @@ char *argv0; #define Glyph Glyph_ #define Font Font_ -#define Draw XftDraw * -#define Colour XftColor -#define Colourmap Colormap -#def

Re: [dev] [st] [patch] typedefs instead of #defines

2014-04-13 Thread noname
On Tue, Apr 08, 2014 at 02:11:24PM +0200, Roberto E. Vargas Caballero wrote: > > -#define Rectangle XRectangle > > > ... > > - Rectangle r; > > + XRectangle r; > > You remove the define at all in this point, and if I remember well, this > define was needed to avoid something. Maybe Christoph

[dev] [st] [patch] move MODBIT to Macros section

2014-04-20 Thread noname
Patch moves MODBIT to macros section and uses it in tselcs. diff --git a/st.c b/st.c index df660ff..8237d78 100644 --- a/st.c +++ b/st.c @@ -64,7 +64,7 @@ char *argv0; #define REDRAW_TIMEOUT (80*1000) /* 80 ms */ -/* macros */ +/* Macros */ #define SERRNO strerror(errno) #define MIN(a, b) (

Re: [dev] [st] [patch] use SERRNO instead of strerror(errno)

2014-04-20 Thread noname
Replaced strerror(errno) with SERRNO where possible. diff --git a/st.c b/st.c index 8237d78..f9ac1f7 100644 --- a/st.c +++ b/st.c @@ -1226,7 +1226,7 @@ ttynew(void) { open(opt_io, O_WRONLY | O_CREAT, 0666); if(iofd < 0) {

Re: [dev] [st] [patch] remove unnecessary line continuations

2014-04-20 Thread noname
Patch attached. diff --git a/st.c b/st.c index df660ff..5cc5da7 100644 --- a/st.c +++ b/st.c @@ -132,7 +132,7 @@ enum term_mode { MODE_MOUSEMANY = 262144, MODE_BRCKTPASTE = 524288, MODE_PRINT = 1048576, - MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_

Re: [dev] [st] [patch] misplaced parenthesis in LEN macro

2014-04-20 Thread noname
diff --git a/st.c b/st.c index df660ff..fbbdc34 100644 --- a/st.c +++ b/st.c @@ -68,7 +68,7 @@ char *argv0; #define SERRNO strerror(errno) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) < (b) ? (b) : (a)) -#define LEN(a) (sizeof(a) / sizeof(a[0])) +#define LEN(a) (si

Re: [dev] [st] [patch] misplaced parenthesis in LEN macro

2014-04-20 Thread noname
On Sun, Apr 20, 2014 at 01:53:33PM +0200, Alexander Huemer wrote: > Hi, > > On Sun, Apr 20, 2014 at 03:41:40PM +0400, non...@inventati.org wrote: > > […] > > -#define LEN(a) (sizeof(a) / sizeof(a[0])) > > +#define LEN(a) (sizeof(a) / sizeof(a)[0]) > > […] > > Why parenthesis anyway? a[0]

[dev] [PATCH] [st 1/3] Use tsetdirt in tscrollup and tscrolldown.

2014-04-20 Thread noname
--- st.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index df660ff..e625237 100644 --- a/st.c +++ b/st.c @@ -1401,14 +1401,13 @@ tscrolldown(int orig, int n) { LIMIT(n, 0, term.bot-orig+1); tclearregion(0, term.bot-n+1, term.col-1, t

[dev] [PATCH] [st 3/3] Style fixes in tscrollup.

2014-04-20 Thread noname
--- st.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index fecf1c2..185c615 100644 --- a/st.c +++ b/st.c @@ -1416,15 +1416,16 @@ void tscrollup(int orig, int n) { int i; Line temp; + LIMIT(n, 0, term.bot-orig+1); tclearr

[dev] [PATCH] [st 2/3] Do not set dirty flag twice in tscrollup and tscrolldown.

2014-04-20 Thread noname
--- st.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/st.c b/st.c index e625237..fecf1c2 100644 --- a/st.c +++ b/st.c @@ -1400,9 +1400,8 @@ tscrolldown(int orig, int n) { LIMIT(n, 0, term.bot-orig+1); - tclearregion(0, term.bot-n+1, term.col-1, term.bot)

Re: [dev] [PATCH] [st 1/3] Use tsetdirt in tscrollup and tscrolldown.

2014-04-20 Thread noname
tscrollup and tscrolldown do not use tsetdirt, but their code is equivalent to tsetdirt(orig, term.bot-n); tsetdirt(orig+n, term.bot); tclearregion also marks cleared lines as dirty. In tscrolldown it sets lines from term.bot-n+1 to term.bot dirty, and in tscrollup it sets lines f

[dev] [st] [PATCH 3/6] Remove argument names from function prototypes.

2014-04-22 Thread noname
--- st.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index 6da4827..64384cd 100644 --- a/st.c +++ b/st.c @@ -360,7 +360,7 @@ static void strparse(void); static void strreset(void); static int tattrset(int); -static void tprinter(char *s, size_t

[dev] [st] [PATCH 2/6] Style fix in tdumpsel.

2014-04-22 Thread noname
--- st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st.c b/st.c index 92fd7da..6da4827 100644 --- a/st.c +++ b/st.c @@ -2256,8 +2256,7 @@ printsel(const Arg *arg) { } void -tdumpsel(void) -{ +tdumpsel(void) { char *ptr; if((ptr = getsel())) { -- 1.

[dev] [st] [PATCH 6/6] Make xrealloc and xstrdup style consistent.

2014-04-22 Thread noname
--- st.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index bb3e687..aba034f 100644 --- a/st.c +++ b/st.c @@ -549,12 +549,10 @@ xrealloc(void *p, size_t len) { char * xstrdup(char *s) { - char *p = strdup(s); - - if (!p) + if((s = strd

[dev] [st] [PATCH 4/6] Use uint and uchar instead of unsigned int and unsigned char.

2014-04-22 Thread noname
--- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 64384cd..b8bf84b 100644 --- a/st.c +++ b/st.c @@ -298,13 +298,13 @@ typedef struct { typedef union { int i; - unsigned int ui; + uint ui; float f; const void

[dev] [st] [PATCH 5/6] Use BETWEEN in tsetchar.

2014-04-22 Thread noname
--- st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st.c b/st.c index b8bf84b..bb3e687 100644 --- a/st.c +++ b/st.c @@ -1544,8 +1544,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) { * The table is proudly stolen from rxvt. */ if(attr->mode &

[dev] [st] [PATCH 1/6] Use BETWEEN in tinsertblankline and tdeleteline.

2014-04-22 Thread noname
--- st.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/st.c b/st.c index 019f53c..92fd7da 100644 --- a/st.c +++ b/st.c @@ -1628,18 +1628,14 @@ tinsertblank(int n) { void tinsertblankline(int n) { - if(term.c.y < term.top || term.c.y > term.bot) -

[dev] [st] [PATCH] Fix techo handling of control characters.

2014-04-22 Thread noname
Internally st represents characters using "char" type. It is used in CSIEscape.buf, Glyph.c etc. However, char can be either signed or unsigned depends on the architecture. On x86 '\x80' < 0x20 is true, but (uchar)'\x80' < 0x20 is false. tputc explicitly converts character to ascii code:

Re: [dev] [st] [PATCH] Fix techo handling of control characters.

2014-04-22 Thread noname
BTW what do you think about converting st code to store characters in uchar instead of char to avoid these problems in the future and avoid manual conversions? tsetchar should probably be fixed too. c[0] >= 0x41 && c[0] <= 0x7e works, but it is better to change type of `c' to uchar *.

Re: [dev] [PATCH] [st 1/3] Use tsetdirt in tscrollup and tscrolldown.

2014-04-22 Thread noname
On Tue, Apr 22, 2014 at 09:34:58PM +0200, Roberto E. Vargas Caballero wrote: > Hi, > > I like these patches, and I want to apply them, but there is a > small thing that I think should be modified. After the patches tscolldown > has: > > tsetdirt(orig, term.bot-n); > tclearregion

[dev] [st] [PATCH] Fix techo handling of control and multibyte characters.

2014-04-22 Thread noname
techo compares signed char to '\x20'. Any character with code less then '\x20' is treated as control character. This way characters with MSB set to 1 are considered control characters too. Also this patch makes techo display DEL character as ^?. To reprocuce the bug, enable echo mode using print

[dev] [PATCH] Simplify tdeletechar and tinsertblank and fix memory corruption.

2014-04-22 Thread noname
Current CSI parsing code uses strtol to parse arguments and allows them to be negative. Negative argument is not properly handled in tdeletechar and tinsertblank and results in memory corruption in memmove. Reproduce with printf '\e[-500@' Patch also removes special handling for corner case and s

[dev] [st PATCH 1/4] Simplify tsetscroll.

2014-04-23 Thread noname
--- st.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/st.c b/st.c index aba034f..ede90d5 100644 --- a/st.c +++ b/st.c @@ -1765,17 +1765,11 @@ tsetattr(int *attr, int l) { void tsetscroll(int t, int b) { - int temp; - LIMIT(t, 0, term.row-1);

[dev] [st PATCH 2/4] Use BETWEEN macro in xsetcolorname and fix style.

2014-04-23 Thread noname
--- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index ede90d5..07f408c 100644 --- a/st.c +++ b/st.c @@ -2750,10 +2750,10 @@ int xsetcolorname(int x, const char *name) { XRenderColor color = { .alpha = 0x }; Colour colour; -

[dev] [st PATCH 3/4] Use != instead of ^ for logical values.

2014-04-23 Thread noname
sel.alt is only changed by sel.alt = IS_SET(MODE_ALTSCREEN); --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 07f408c..e61ee68 100644 --- a/st.c +++ b/st.c @@ -3449,7 +3449,7 @@ drawregion(int x1, int y1, int x2, int y2) { bool ena_sel

[dev] [st PATCH 4/4] Optimize tputtab.

2014-04-23 Thread noname
Before this patch executing printf '\e[100I' or printf '\e[100Z' resulted in long delay. --- st.c | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/st.c b/st.c index e61ee68..964a0ae 100644 --- a/st.c +++ b/st.c @@ -3

Re: [dev] [st] [PATCH] Fix techo handling of control and multibyte characters.

2014-04-23 Thread noname
On Wed, Apr 23, 2014 at 08:26:32PM +0200, Roberto E. Vargas Caballero wrote: > Applied with a small modification. Thanks u suffix was here for a purpose. The patch has comment about multibyte characters. As 0x20u is unsigned, c was converted to unsigned char before comparison so multibyte ch

Re: [dev] [st] [PATCH] Fix techo handling of control and multibyte characters.

2014-04-25 Thread noname
On Thu, Apr 24, 2014 at 07:29:35AM +0200, Roberto E. Vargas Caballero wrote: > Hello, > > > u suffix was here for a purpose. The patch has comment about multibyte > > characters. As 0x20u is unsigned, c was converted to unsigned char > > before comparison so multibyte characters were not conside

[dev] [st patch queue 01/12] Simplify tsetscroll.

2014-04-25 Thread noname
--- st.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/st.c b/st.c index 60243a7..816caf7 100644 --- a/st.c +++ b/st.c @@ -1762,17 +1762,10 @@ tsetattr(int *attr, int l) { void tsetscroll(int t, int b) { - int temp; - LIMIT(t, 0, term.row-1);

[dev] [st patch queue 02/12] Use BETWEEN macro in xsetcolorname and fix style.

2014-04-25 Thread noname
--- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 816caf7..35bbe9c 100644 --- a/st.c +++ b/st.c @@ -2746,10 +2746,10 @@ int xsetcolorname(int x, const char *name) { XRenderColor color = { .alpha = 0x }; Colour colour; -

[dev] [st patch queue 03/12] Use != instead of ^ for logical values.

2014-04-25 Thread noname
sel.alt is only changed by sel.alt = IS_SET(MODE_ALTSCREEN); --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 35bbe9c..083d1c1 100644 --- a/st.c +++ b/st.c @@ -3445,7 +3445,7 @@ drawregion(int x1, int y1, int x2, int y2) { bool ena_sel

[dev] [st patch queue 04/12] Comment fix.

2014-04-25 Thread noname
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 083d1c1..fd342aa 100644 --- a/st.c +++ b/st.c @@ -990,7 +990,7 @@ selnotify(XEvent *e) { } /* -* As seen in selcopy: +* As seen in getsel

[dev] [st patch queue 07/12] Remove unnecessary break;s

2014-04-25 Thread noname
--- st.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/st.c b/st.c index 9de7f81..061dafd 100644 --- a/st.c +++ b/st.c @@ -1778,7 +1778,6 @@ tsetmode(bool priv, bool set, int *args, int narg) { for(lim = args + narg; args < lim; ++args) { if(priv) {

[dev] [st patch queue 05/12] Consistent FALLTHROUGH comments.

2014-04-25 Thread noname
--- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index fd342aa..dae23c5 100644 --- a/st.c +++ b/st.c @@ -1839,7 +1839,7 @@ tsetmode(bool priv, bool set, int *args, int narg) { if (!allowaltscreen)

[dev] [st patch queue 06/12] Avoid integer overflow in dump().

2014-04-25 Thread noname
--- st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/st.c b/st.c index dae23c5..9de7f81 100644 --- a/st.c +++ b/st.c @@ -1234,8 +1234,10 @@ dump(char c) { static int col; fprintf(stderr, " %02x '%c' ", c, isprint(c)?c:'.'); - if(++col % 10 == 0) +

[dev] [st patch queue 11/12] Fix for multibyte characters in techo.

2014-04-25 Thread noname
Works for both signed and unsigned char. --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 22ce4fb..cb95b8c 100644 --- a/st.c +++ b/st.c @@ -2292,7 +2292,7 @@ techo(char *buf, int len) { for(; len > 0; buf++, len--) { char c = *b

[dev] [st patch queue 12/12] Do not eat ESC character if control string is not properly terminated.

2014-04-25 Thread noname
Currently tputc handles the case of too long control string waiting for the end of control string. Another case is when there is ESC character is encountered but is not followed by '\\'. In this case st stops processing control string, but ESC character is ignored. After this patch st processes

[dev] [st patch queue 10/12] s/DSC/DCS/ DCS stands for DEVICE CONTROL STRING

2014-04-25 Thread noname
--- st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 5477c81..22ce4fb 100644 --- a/st.c +++ b/st.c @@ -149,7 +149,7 @@ enum charset { enum escape_state { ESC_START = 1, ESC_CSI= 2, - ESC_STR= 4, /* DSC, OSC,

[dev] [st patch queue 08/12] Use xwrite instead of write.

2014-04-25 Thread noname
--- st.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 061dafd..e4df18f 100644 --- a/st.c +++ b/st.c @@ -450,7 +450,7 @@ static char utf8encodebyte(long, size_t); static size_t utf8len(char *); static size_t utf8validate(long *, size_t); -static ss

[dev] [st patch queue 09/12] Simplify tdeletechar and tinsertblank and fix memory corruption.

2014-04-25 Thread noname
Removed special handling of corner case. Current CSI parsing code uses strtol to parse arguments and allows them to be negative. Negative argument is not properly handled in tdeletechar and tinsertblank and results in memory corruption in memmove. Reproduce with printf '\e[-500@' --- st.c | 26 +

[dev] [st] [PATCH] Simplify selected().

2014-04-27 Thread noname
--- st.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/st.c b/st.c index 237ce8e..bd0d3ca 100644 --- a/st.c +++ b/st.c @@ -665,18 +665,13 @@ selsort(void) { static inline bool selected(int x, int y) { - if(sel.ne.y == y && sel.nb.y == y) -

[dev] [st PATCH 1/6] Compute ena_sel as one expression.

2014-04-27 Thread noname
--- st.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/st.c b/st.c index bd0d3ca..41a3e3c 100644 --- a/st.c +++ b/st.c @@ -3441,12 +3441,9 @@ drawregion(int x1, int y1, int x2, int y2) { int ic, ib, x, y, ox, sl; Glyph base, new; char buf[DRAW_BUF_

[dev] [st PATCH 2/6] Use MODBIT in xseturgency.

2014-04-27 Thread noname
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 41a3e3c..afede52 100644 --- a/st.c +++ b/st.c @@ -3520,7 +3520,7 @@ void xseturgency(int add) { XWMHints *h = XGetWMHints(xw.dpy, xw.win); - h->flags = add ? (h->flags | XUrgencyHint) :

[dev] [st PATCH 5/6] Remove unused dump() function.

2014-04-27 Thread noname
--- st.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/st.c b/st.c index 6abda84..aa804eb 100644 --- a/st.c +++ b/st.c @@ -394,7 +394,6 @@ static int32_t tdefcolor(int *, int *, int); static void tselcs(void); static void tdeftran(char); static inline bool match(uint, uint); -s

[dev] [st PATCH 3/6] Add missing function prototypes.

2014-04-27 Thread noname
--- st.c | 5 + 1 file changed, 5 insertions(+) diff --git a/st.c b/st.c index afede52..6abda84 100644 --- a/st.c +++ b/st.c @@ -394,6 +394,7 @@ static int32_t tdefcolor(int *, int *, int); static void tselcs(void); static void tdeftran(char); static inline bool match(uint, uint); +static

[dev] [st PATCH 4/6] Do not export chscale and cwscale.

2014-04-27 Thread noname
--- config.def.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index d69c9ba..646a88a 100644 --- a/config.def.h +++ b/config.def.h @@ -10,8 +10,8 @@ static int borderpx = 2; static char shell[] = "/bin/sh"; /* Kerning / character bounding-b

[dev] [st PATCH 6/6] Remove one indentation level in getsel().

2014-04-27 Thread noname
--- st.c | 91 ++-- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/st.c b/st.c index aa804eb..2750bfa 100644 --- a/st.c +++ b/st.c @@ -912,60 +912,59 @@ getsel(void) { int x, y, bufsize, size, i, ex; G

[dev] [dwm PATCH] Add missing getatomprop prototype.

2014-04-27 Thread noname
--- dwm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dwm.c b/dwm.c index 1bbb4b3..2cadebc 100644 --- a/dwm.c +++ b/dwm.c @@ -169,6 +169,7 @@ static void focus(Client *c); static void focusin(XEvent *e); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); +stat

[dev] [st PATCH] Simplify tputtab.

2014-04-27 Thread noname
--- st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 2750bfa..689dce0 100644 --- a/st.c +++ b/st.c @@ -2267,11 +2267,11 @@ tputtab(int n) { if(n > 0) { while(x < term.col && n--) - for(++x; x < term.col &

Re: [dev] [st PATCH 3/6] Add missing function prototypes.

2014-04-27 Thread noname
On Sun, Apr 27, 2014 at 06:32:36PM +0200, Markus Teich wrote: > noname wrote: > > +static void dump(char c); > > Heyho, > > Wasn't this the function, which is never used? > > --Markus > It is. After I made it static, gcc gives a warning about it, so I removed it later in the same patchset.

[dev] [st PATCH] tresize return value is not used

2014-04-27 Thread noname
--- st.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/st.c b/st.c index b8fec4c..25da193 100644 --- a/st.c +++ b/st.c @@ -378,7 +378,7 @@ static void tnewline(int); static void tputtab(int); static void tputc(char *, int); static void treset(void); -static int tre

[dev] [st PATCH] Use tfulldirt instead of setting all lines dirty in tresize.

2014-04-27 Thread noname
--- st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st.c b/st.c index 25da193..57cc4c4 100644 --- a/st.c +++ b/st.c @@ -2621,14 +2621,12 @@ tresize(int col, int row) { /* resize each row to new width, zero-pad if needed */ for(i = 0; i < minrow; i++) {

Re: [dev] [st PATCH] Use tfulldirt instead of setting all lines dirty in tresize.

2014-04-27 Thread noname
In fact tfulldirt should be removed completely, as tswapscreen calls tfulldirt later (twice).

[dev] [st PATCH] Simplify xunloadfonts.

2014-04-27 Thread noname
--- st.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index 57cc4c4..087d2c9 100644 --- a/st.c +++ b/st.c @@ -2940,13 +2940,9 @@ xunloadfont(Font *f) { void xunloadfonts(void) { - int i; - /* Free the loaded fonts in the font cache. */

Re: [dev] [st] [PATCH] Simplify selected().

2014-04-28 Thread noname
On Mon, Apr 28, 2014 at 06:58:29PM +0200, Roberto E. Vargas Caballero wrote: > Uhmmm, I am not sure about this patch, because it is related to some > parts of st that are not handled by me, and I am not sure if these > modifications are correct. Could someone else take care of this patch? > > Rega

Re: [dev] [st PATCH] Simplify tputtab.

2014-04-28 Thread noname
On Mon, Apr 28, 2014 at 10:54:21AM +0200, Roberto E. Vargas Caballero wrote: > > - for(++x; x < term.col && !term.tabs[x]; ++x) > > + while(++x < term.col && !term.tabs[x]) > ... > > - for(--x; x > 0 && !term.tabs[x]; --x) > > +

Re: [dev] [st] Feature to replace st window by spawned x window

2014-04-28 Thread noname
On Mon, Apr 28, 2014 at 05:17:56PM -0400, Nick wrote: > Does someone with more knowledge of X11 know whether this is likely > to be readily do-able? Can you launch an arbitrary X program and say > "use this window"? I'm guessing not, but don't really know. It is impossible as each application ca

[dev] [st PATCH] Do not save cursor in tresize.

2014-04-28 Thread noname
This patch fixes the bug introduced in 8f11e1cd034ff28ca47bb4955505db7fa8016ba8 To reproduce the bug: 1. Save cursor: printf '\e[s' 2. Load cursor: printf '\e[u' 3. Resize st window. 4. Load cursor again: printf '\e[u' --- st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

Re: [dev] [st patch queue 05/12] Consistent FALLTHROUGH comments.

2014-04-30 Thread noname
On Fri, Apr 25, 2014 at 06:21:10PM +0200, Roberto E. Vargas Caballero wrote: > It is true that it is ugly to have different styles in fall through, > but it is also true that we have a lot of fall through where we don't > put any comment. Put a comment in all these places is a very bad idea, > but

[dev] [st PATCH] Simplify tdeftran.

2014-04-30 Thread noname
--- st.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/st.c b/st.c index d0c4595..3f248f3 100644 --- a/st.c +++ b/st.c @@ -2305,19 +2305,17 @@ techo(char *buf, int len) { void tdeftran(char ascii) { - char c, (*bp)[2]; - static char tb

[dev] [tabbed PATCH] Replace emallocz with ecalloc.

2014-05-24 Thread noname
--- tabbed.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tabbed.c b/tabbed.c index 2341998..ba22f9a 100644 --- a/tabbed.c +++ b/tabbed.c @@ -97,7 +97,7 @@ static void destroynotify(const XEvent *e); static void die(const char *errstr, ...); static void drawba

[dev] [sbase] [PATCH] Replace strlen with unary_n to test zero length.

2015-02-22 Thread noname
--- test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.c b/test.c index 660048a..957b205 100644 --- a/test.c +++ b/test.c @@ -100,7 +100,7 @@ noarg(char **argv) static int onearg(char **argv) { - return strlen(argv[0]); + return unary_n(argv[0]); } s

[dev] [vis] buffer_alloc issues

2015-03-25 Thread noname
I'm not sure if vis is supported in suckless mailing list, but as it was discussed here previously, i'm writing here. There are two issues with buffer_alloc function(s). First function is located in buffer.c: http://repo.or.cz/w/vis.git/blob/HEAD:/buffer.c The problem is on line 15: http://repo.

Re: [dev] [vis] buffer_alloc issues

2015-03-29 Thread noname
On Sun, Mar 29, 2015 at 03:45:50PM +0200, Silvan Jegen wrote: > Heyho! > > On Wed, Mar 25, 2015 at 07:15:08PM +, non...@inventati.org wrote: > > There are two issues with buffer_alloc function(s). > > > > First function is located in buffer.c: > > http://repo.or.cz/w/vis.git/blob/HEAD:/buffer

Re: [dev] [surf] [patch] 13 patches from my Universal Same-Origin Policy branch

2015-03-29 Thread noname
How about sending no UA at all? If all privacy-aware browsers drop UA, that would be optimal. Drop UA in Dillo, TorBrowser, drop UA in other browsers with add-ons etc. Otherwise all privacy-aware browsers try to adjust their UA to maximize "anonymity set", they all look different and this story n

Re: [dev] [surf] [patch] 13 patches from my Universal Same-Origin Policy branch

2015-03-29 Thread noname
On Sun, Mar 29, 2015 at 09:03:49PM +0200, Antenore Gatta wrote: > On 29/03/15 17:03:25, non...@inventati.org wrote: > > How about sending no UA at all? > > > > Not sending a UA at all, makes your browser fingerprint uniq and not the other > way around. > > Probably a safer solution is to have an

Re: [dev] [surf] [patch] 13 patches from my Universal Same-Origin Policy branch

2015-03-29 Thread noname
On Sun, Mar 29, 2015 at 09:58:42PM +0200, Markus Teich wrote: > even then you are still in the anonymity set of „Hey look, that guy want's to > be > anonymous, let's focus our effort on him!“. Think again. Advertisers focus on people who would click on advertisements, not the guys pretending to b

[dev] [vis] [PATCH] Fixed multiline comment regexp.

2015-04-01 Thread noname
Comments like "/***/" with odd number of asterisks are handled like normal comments now. Previously they were handled like unfinished comments. Support for comments without opening "/*" at the beginning of the file is removed because people do not normally write comments backwards. --- config.def

Re: [dev] [vis] [PATCH] Fixed multiline comment regexp.

2015-04-02 Thread noname
On Thu, Apr 02, 2015 at 01:42:35AM +0200, koneu wrote: > noname wrote: > > Support for comments without opening "/*" at the beginning of the file > > is removed because people do not normally write comments backwards. > Oh look, I never knew it was possible to write

Re: [dev] [vis] [PATCH] Fixed multiline comment regexp.

2015-04-03 Thread noname
On Fri, Apr 03, 2015 at 07:21:49PM +0200, Marc André Tanner wrote: > On Thu, Apr 02, 2015 at 02:27:31AM +0300, noname wrote: > > Comments like "/***/" with odd number of asterisks are handled like > > normal comments now. Previously they were handled like unfinished >

[dev] [vis] [PATCH] Fixed multiline comment regexp.

2015-04-03 Thread noname
Comments like "/***/" with odd number of asterisks are handled like normal comments now. Previously they were handled like unfinished comments. --- config.def.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h index ee6d4ae..2a9e258 100644 ---

Re: [dev] [vis] [PATCH] Fixed multiline comment regexp.

2015-04-03 Thread noname
On Fri, Apr 03, 2015 at 07:21:49PM +0200, Marc André Tanner wrote: > On Thu, Apr 02, 2015 at 02:27:31AM +0300, noname wrote: > > Support for comments without opening "/*" at the beginning of the file > > is removed because people do not normally write comments backward

Re: [dev] [vis] ui separation and mainloop considerations

2015-04-05 Thread noname
On Sat, Apr 04, 2015 at 12:48:14AM +0200, Marc André Tanner wrote: > What is your opinion on libuv? Is there a better alternative I > should look into? What would you use for communication purposes? > Sending raw structs around or using something like msgpack? http://suckless.org/rocks links libev

[dev] [st] [PATCH] Fixed STR sequence termination condition

2015-04-05 Thread noname
ascii code may only be checked for characters that have length equal to 1, not width equal to 1 --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 39d3fee..827ed08 100644 --- a/st.c +++ b/st.c @@ -2663,7 +2663,7 @@ tputc(char *c, int len) { * ch

Re: [dev] [st] [PATCH] Fixed STR sequence termination condition

2015-04-06 Thread noname
On Mon, Apr 06, 2015 at 10:50:07AM +0200, Roberto E. Vargas Caballero wrote: > > ascii code may only be checked for characters that have length equal to > > 1, not width equal to 1 > > I think they are equivalent, but I like more the 'len' versin, so > I will apply it. They are not equivalent at

Re: [dev] [st] [PATCH 2/2] Simplify window mapping loop.

2015-04-10 Thread noname
On Fri, Apr 10, 2015 at 05:41:16PM +0200, Roberto E. Vargas Caballero wrote: > > - if(XFilterEvent(&ev, None)) > > - continue; > > Why are you removing the call to XFilterEvent here? XFilterEvent usually filters KeyPress events that are hooked by input method, but at t

[dev] [st] [PATCH 2/2] Remove keywords from function definitions.

2015-04-08 Thread noname
--- st.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/st.c b/st.c index 6522c9d..7dbd87a 100644 --- a/st.c +++ b/st.c @@ -408,6 +408,7 @@ static void ttysend(char *, size_t); static void ttywrite(const char *, size_t); static void tstrsequence(uchar);

[dev] [st] [PATCH 3/3] Remove 'xloadfontset' function.

2015-04-08 Thread noname
It was used only once and its return value was ignored. --- st.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/st.c b/st.c index 7dbd87a..0065240 100644 --- a/st.c +++ b/st.c @@ -419,7 +419,6 @@ static int xsetcolorname(int, const char *); static int xgeommask

[dev] [PATCH 1/2] Remove variable names from function declarations.

2015-04-08 Thread noname
--- st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 6d20977..6522c9d 100644 --- a/st.c +++ b/st.c @@ -359,7 +359,7 @@ static void csidump(void); static void csihandle(void); static void csiparse(void); static void csireset(void); -static int eschan

[dev] [st] [PATCH 1/2] Use MAX macro where possible.

2015-04-09 Thread noname
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 0065240..a7064b1 100644 --- a/st.c +++ b/st.c @@ -4072,7 +4072,7 @@ main(int argc, char *argv[]) { run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); - tnew(cols? cols : 1, row

[dev] [st] [PATCH 2/2] Simplify window mapping loop.

2015-04-09 Thread noname
--- st.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index a7064b1..c311164 100644 --- a/st.c +++ b/st.c @@ -3917,17 +3917,13 @@ run(void) { long deltatime; /* Waiting for window mapping */ - while(1) { + do {

[dev] [st] [PATCH 1/2] Use do..while in window mapping loop.

2015-04-11 Thread noname
--- st.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index b2bcfe9..83acd56 100644 --- a/st.c +++ b/st.c @@ -3917,17 +3917,15 @@ run(void) { long deltatime; /* Waiting for window mapping */ - while(1) { + do {

[dev] [st] [PATCH 2/2] Remove unnecessary XFilterEvent call.

2015-04-11 Thread noname
XFilterEvent usually filters KeyPress events according to input method. At this point the window is not mapped. The only events that we process are ConfigureNotify and MapNotify. They should not be filtered by input method. --- st.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/st.c b/st.c

[dev] [st] [PATCH 1/2] Use do..while in window mapping loop.

2015-04-11 Thread noname
--- st.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index b2bcfe9..83acd56 100644 --- a/st.c +++ b/st.c @@ -3917,17 +3917,15 @@ run(void) { long deltatime; /* Waiting for window mapping */ - while(1) { + do {

[dev] [st] [PATCH 2/2] Simplify loop condition.

2015-04-11 Thread noname
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index df79e93..28beca2 100644 --- a/st.c +++ b/st.c @@ -944,7 +944,7 @@ getsel(void) { ptr = str = xmalloc(bufsize); /* append every set & selected glyph to the selection */ - for(y = s

[dev] [st] [PATCH 1/2] Do not use switch for fork() call.

2015-04-11 Thread noname
--- st.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/st.c b/st.c index c48132a..df79e93 100644 --- a/st.c +++ b/st.c @@ -1257,11 +1257,10 @@ ttynew(void) { if(openpty(&m, &s, NULL, NULL, &w) < 0) die("openpty failed: %s\n", strerror(errno

[dev] [st] [PATCH 1/3] tresize: move for loop outside if

2015-04-11 Thread noname
There is no need to check that slide > 0 before executing loop. If slide <= 0, loop stops immediately. --- st.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/st.c b/st.c index b4e17e4..3b45c42 100644 --- a/st.c +++ b/st.c @@ -2781,17 +2781,16 @@ tresize(int col, int

[dev] [st] [PATCH 2/3] Move tresize comments around.

2015-04-11 Thread noname
--- st.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/st.c b/st.c index 3b45c42..51bd40c 100644 --- a/st.c +++ b/st.c @@ -2780,17 +2780,16 @@ tresize(int col, int row) { return; } - /* free unneeded rows */ + /* +* sl

[dev] [st] [PATCH 3/3] Remove 'slide' variable in tresize.

2015-04-11 Thread noname
--- st.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/st.c b/st.c index 51bd40c..ce2646e 100644 --- a/st.c +++ b/st.c @@ -2770,7 +2770,6 @@ tresize(int col, int row) { int i; int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); -

Re: [dev] [st] [PATCH 3/3] Remove 'slide' variable in tresize.

2015-04-11 Thread noname
The commiter can squash 3 commits into 1 using rebase -i if he wants. I tried to separate moving loop outside if and removing local variable. I think these changes are independent.

[dev] [st] [PATCH 4/3] tresize: remove unnecessary if

2015-04-12 Thread noname
--- st.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index 109122e..f183803 100644 --- a/st.c +++ b/st.c @@ -2788,10 +2788,8 @@ tresize(int col, int row) { free(term.line[i]); free(term.alt[i]); } - if(i > 0) {

Re: [dev] [st] [PATCH 4/3] tresize: remove unnecessary if

2015-04-12 Thread noname
On Sun, Apr 12, 2015 at 10:41:36AM +0200, Silvan Jegen wrote: > I was thinking about this option too but in that case you would be > calling memmove with an identical src and dst when i == 0. The man page > for glibc memmove(3) does not mention anything about this being a noop > so I am not sure th

Re: [dev] [st] [PATCH 4/3] tresize: remove unnecessary if

2015-04-12 Thread noname
On Sun, Apr 12, 2015 at 11:35:42AM +0200, Silvan Jegen wrote: > I just wonder if it really will be copying the data around into a > temporary array for no reason when i == 0 (either in glibc or in another > libc). Well, it does not really move data to temporary array, memmove just chooses the righ

Re: [dev] [dmenu] Potential bug in dmenu Ctrl+Enter handling

2015-04-12 Thread noname
On Sun, Apr 12, 2015 at 11:18:02AM -0700, Eric Pruitt wrote: > While looking at the dmenu source code to make a patch for it, I noticed > this conditional on line 371: "if(!(ev->state & ControlMask))". It looks > as though pressing Ctrl+(Shift)+Enter is supposed to print the current > selection to

Re: [dev] Re: [dmenu] [PATCH] Make Ctrl+Enter print current selection

2015-04-12 Thread noname
Try to clone a clean git repo from git.suckless.org. For me everything works as expected without any patches.

Re: [dev] [st] [PATCH 1/2] Do not use switch for fork() call.

2015-04-13 Thread noname
On Mon, Apr 13, 2015 at 09:20:34AM +0200, Roberto E. Vargas Caballero wrote: > I don't understand this patch. The switch-fork is a common idiom > and I don't know why you think it should be changed. It separates the case when fork fails and when fork succeeds. You can even move error-processing c

[dev] [st] [PATCH 1/3] Fix typo.

2015-04-13 Thread noname
It seems that LICENSE files are more common than LICENCE files. At least this patch makes spelling consistent. --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index f183803..db35e71 100644 --- a/st.c +++ b/st.c @@ -1,4 +1,4 @@ -/* See LICENSE for licence de

[dev] [st] [PATCH 3/3] Simplify tmoveto.

2015-04-13 Thread noname
LIMIT returns value. This fact is already used in x2col and y2row. --- st.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index e01df66..33fd4de 100644 --- a/st.c +++ b/st.c @@ -1572,11 +1572,9 @@ tmoveto(int x, int y) { miny = 0;

[dev] [st] [PATCH 2/3] Do not use tmoveto in tputtab.

2015-04-13 Thread noname
tmoveto resets CURSOR_WRAPNEXT. Simple testcase: for i in $(seq 1 200); do printf '\t.'; usleep 10; printf '\t@'; usleep 10; done In st executing this script causes @ and . to overwrite each other in the last column. --- st.c | 2 +- 1 file changed, 1 ins

[dev] [st] [PATCH] Remove useless if in tstrsequence.

2015-04-13 Thread noname
--- st.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/st.c b/st.c index b2bcfe9..154dd52 100644 --- a/st.c +++ b/st.c @@ -2446,21 +2446,19 @@ tdectest(char c) { void tstrsequence(uchar c) { - if (c & 0x80) { - switch (c)

  1   2   >