Re: [dev] [st] [PATCH] Do not set terminal title based on stty arguments.

2015-04-21 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [dev] [st utf8 1/4] Use utf8len instead of utf8decode.

2015-04-21 Thread noname
First two patches can be applied. The second patch is not mine, I just cherry-picked it from wchar branch. Third patch changes internal representation in Glyph and makes it work. Fourth patch changes some functions mostly in the way already done in wchar branch. The general idea is to decode UTF-

Re: [dev] [vis] [PATCH] Fix handling of file load errors

2015-04-21 Thread Marc André Tanner
On Tue, Apr 14, 2015 at 05:25:15PM +0200, Willem van de Krol wrote: > Permission errors are handled in text_load(). To detect these errors, > and other open() errors (opening a directory, for example), check the > return value of text_load(). > > This fixes a segmentation fault when opening a dire

[dev] [libsl] [PATCH 4/4] drw: fixup font handling

2015-04-21 Thread Markus Teich
--- drw.c | 120 -- drw.h | 17 +- 2 files changed, 75 insertions(+), 62 deletions(-) diff --git a/drw.c b/drw.c index 078b6b8..196f53b 100644 --- a/drw.c +++ b/drw.c @@ -11,6 +11,8 @@ #define UTF_INVALID 0xFFFD #define UT

[dev] [libsl] [PATCH 2/4] drw: fixup color schemes

2015-04-21 Thread Markus Teich
--- drw.c | 41 + drw.h | 24 ++-- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/drw.c b/drw.c index 6c0859e..362484a 100644 --- a/drw.c +++ b/drw.c @@ -171,35 +171,36 @@ drw_font_free(Fnt *font) { free(font);

[dev] [libsl] [PATCH 1/4] drw: fixup font_getexts

2015-04-21 Thread Markus Teich
--- drw.c | 30 +++--- drw.h | 8 +--- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/drw.c b/drw.c index eb3b3c3..6c0859e 100644 --- a/drw.c +++ b/drw.c @@ -220,7 +220,7 @@ int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const c

[dev] [libsl] [PATCH 3/4] drw: fixup drw_rect function

2015-04-21 Thread Markus Teich
--- drw.c | 16 +++- drw.h | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drw.c b/drw.c index 362484a..078b6b8 100644 --- a/drw.c +++ b/drw.c @@ -204,17 +204,15 @@ drw_setscheme(Drw *drw, Scm *scm) { } void -drw_rect(Drw *drw, int x, int y, unsigned int w,

[dev] [st utf8 4/4] Make tputc, tsetchar and techo accept unicode

2015-04-21 Thread noname
--- st.c | 107 --- 1 file changed, 45 insertions(+), 62 deletions(-) diff --git a/st.c b/st.c index fa21c4e..3a37994 100644 --- a/st.c +++ b/st.c @@ -383,20 +383,20 @@ static void tmoveato(int, int); static void tnew(int, int); st

[dev] [st utf8 3/4] Change internal character representation.

2015-04-21 Thread noname
--- st.c | 79 +--- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/st.c b/st.c index 0c31fc5..fa21c4e 100644 --- a/st.c +++ b/st.c @@ -72,6 +72,7 @@ char *argv0; #define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) ==

[dev] [st utf8 2/4] Remove last parameter of utf8encode

2015-04-21 Thread noname
This parameter was always UTF_SIZ, so it is better remove it and use directly UTF_SIZ in in. --- st.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/st.c b/st.c index b756a40..0c31fc5 100644 --- a/st.c +++ b/st.c @@ -459,7 +459,7 @@ static void mousereport(XEvent *)

[dev] [st utf8 1/4] Use utf8len instead of utf8decode.

2015-04-21 Thread noname
--- st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st.c b/st.c index 0204b2e..b756a40 100644 --- a/st.c +++ b/st.c @@ -3672,7 +3672,6 @@ drawregion(int x1, int y1, int x2, int y2) { Glyph base, new; char buf[DRAW_BUF_SIZ]; bool ena_sel = sel.ob.x

[dev] [st] [PATCH] Do not set terminal title based on stty arguments.

2015-04-21 Thread noname
--- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 0204b2e..3e706f7 100644 --- a/st.c +++ b/st.c @@ -4066,7 +4066,7 @@ run: if(argc > 0) { /* eat all remaining arguments */ opt_cmd = argv; - if(!opt_t

[dev] Odds and ends (2/2): $XEMBED

2015-04-21 Thread Connor Lane Smith
Hi again, In Plan 9, when one executes a graphical program from a terminal window it will take over that window, so that running a graphical text editor like Sam from a terminal is not so different from running a line editor. This was one of my favourite things from the Plan 9 GUI. Plan 9 Port do

[dev] Odds and ends (1/2): next.sh

2015-04-21 Thread Connor Lane Smith
Hi all, These are just a couple of thoughts I've had that we've discussed a little in IRC recently. They aren't exactly earth-shattering, but I think they might still be of use to someone. Shell aliases which give default arguments, like alias ls='ls -1', are useful but must be invoked from the s

[dev] [st] [PATCH] Replace close and dup with dup2.

2015-04-21 Thread noname
--- st.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/st.c b/st.c index 0204b2e..adf0b62 100644 --- a/st.c +++ b/st.c @@ -1298,8 +1298,7 @@ ttynew(void) { if (opt_line) { if((cmdfd = open(opt_line, O_RDWR)) < 0) die("open lin

Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread noname
At least we can safely reduce to uint16_t now.

Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread noname
On Tue, Apr 21, 2015 at 10:32:26AM -0700, Eric Pruitt wrote: > On Tue, Apr 21, 2015 at 07:03:57PM +0200, Roberto E. Vargas Caballero wrote: > > The problem here is that st was designed in this way, and to change it > > is going to generate segfault in all the users that update the st > > version wi

Re: [dev] [st PATCH 1/3] xloadcols: remove cp variable

2015-04-21 Thread noname
On Tue, Apr 21, 2015 at 07:54:27AM +0200, Roberto E. Vargas Caballero wrote: > > Hi, > > > - Color *cp; > > > > if(loaded) { > > - for (cp = dc.col; cp < dc.col + LEN(dc.col); ++cp) > > - XftColorFree(xw.dpy, xw.vis, xw.cmap, cp); > > + for (i = 0; i

Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread Michael Savage
On Tue, Apr 21, 2015 at 07:03:57PM +0200, Roberto E. Vargas Caballero wrote: > Guys, are you using colors upper 256? I use it for my background and cursor colours.

Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread Eric Pruitt
On Tue, Apr 21, 2015 at 07:03:57PM +0200, Roberto E. Vargas Caballero wrote: > The problem here is that st was designed in this way, and to change it > is going to generate segfault in all the users that update the st > version without changing the config file. Is that really a concern? My st buil

Re: [dev] [st][PATCH v2] Add tty line support

2015-04-21 Thread Roberto E. Vargas Caballero
> > + if (opt_line) { > > + if((cmdfd = open(opt_line, O_RDWR)) < 0) > > + die("open line failed: %s\n", strerror(errno)); > > + close(STDIN_FILENO); > > + dup(cmdfd); > > + stty(); > > + return; > Is the duplication of the cmd

Re: [dev] [PATCH] Make build shut up about system() without return value check.

2015-04-21 Thread Roberto E. Vargas Caballero
> st.c:1321:2: warning: ignoring return value of function declared with > warn_unused_result attribute [-Wunused-result] > system(cmd); > ^~ ~~~ I usually don't care about this kind of warnings, but in this case I think we should check the value returned by system

Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread Roberto E. Vargas Caballero
Hi, > Hello, I noticed that the Glyph struct was using more memory than was > needed. Considering that the fg and bg colors have values that are > always in the range of [0, 255], there is no need to use a uint32_t > for them. A single byte each would suffice. Furthermore, assuming This is a good

[dev] [st] [PATCH] Optimize memory footprint of line buffers

2015-04-21 Thread suigin
Hello, I noticed that the Glyph struct was using more memory than was needed. Considering that the fg and bg colors have values that are always in the range of [0, 255], there is no need to use a uint32_t for them. A single byte each would suffice. Furthermore, assuming default alignment and packin

[dev] [PATCH] Make build shut up about system() without return value check.

2015-04-21 Thread Alex Pilon
st.c:1321:2: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result] system(cmd); ^~ ~~~ Debatable whether an error here should case exit(EXIT_FAILURE). Just preserving the existing behaviour for now. --- st.c | 3 ++

Re: [dev] [st][PATCH v2] Add tty line support

2015-04-21 Thread Alex Pilon
On Tue, Apr 14, 2015 at 12:35:52PM +0200, Roberto E. Vargas Caballero wrote: > + if (opt_line) { > + if((cmdfd = open(opt_line, O_RDWR)) < 0) > + die("open line failed: %s\n", strerror(errno)); > + close(STDIN_FILENO); > + dup(cmdfd); > +

Re: [dev] [st PATCH 1/3] xloadcols: remove cp variable

2015-04-21 Thread Mihail Zenkov
> I prefer the pointer version. I don't know why an index version > is better in this case. The reference here is [1], section "The > use of pointers". IMHO in this particular case index version much better for reading and understanding.

Re: [dev] [st PATCH 3/3] Move common code to xloadcolor.

2015-04-21 Thread Roberto E. Vargas Caballero
Applied, thanks.