Re: [dev] [faq] How do I push to st repository?
Quoth Greg Reagle: > I have a pretty good basic understanding of > git and I've created, merged, and deleted branches, for instance, but a > good solid education in git will be very useful. Thanks again. I recommend these: https://www.youtube.com/watch?v=1ffBJ4sVUb4 https://github.com/pluralsight/git-internals-pdf/releases Turns out learning the internals of git first is a good way to learn it.
Re: [dev] [sbase] No -lrt in config.mk
On Mon, Mar 16, 2015 at 09:42:50PM -0700, Eric Pruitt wrote: > Is there a reason -lrt is missing from config.mk in sbase? I recall > seeing some messages saying that OpenBSD lacks -lrt support (or > something to that effect), but since its a POSIX library and is required > to compile find, it seems like it should be present by default. > Searching the list for "-lrt", I see Roberto submitted a patch on > February 20th; why wasn't it applied? Just update config.mk for your system. This is the primary purpose of having config.mk in the first place. It wasn't applied because it makes me having to remember to remove -lrt on all of my OpenBSD systems that I am working on. That's why I added a commented out -lrt in config.mk, to remind people that they may need it. On a similar note, NetBSD needs some stupid feature test macros in order to expose various declarations/defines to the application. I have not enabled those by default either. The end result is the same though, it doesn't build by default.
Re: [dev] Scope of sbase and ubase
Hi. On Mon, Mar 09, 2015 at 02:05:39PM +0100, FRIGN wrote: > On Mon, 9 Mar 2015 01:51:59 +0100 > Alexander Huemer wrote: > > Hey Alexander, Thanks for you answer FRIGN. > > while reading the README file of sbase I noticed `sponge`, remembered > > that that's from moreutils and realized that sbase does not provide a > > strict subset of coreutils, what I assumed for some reason. > > sbase is a strict subset of coreutils + moreutils + plan9, but it's all about > providing a sane collection of programs needed for everyday use. > > > Both definitions make sense, but they are a bit unprecise IMO. > > These are not definitions, but descriptions. By definition, all tools in sbase > are portable and the ones in ubase are non-portable. Well, then let me rephrase that. The descriptions are not very distinct. I try to think myself into a person why has no prior knowledge about sbase and ubase and from that point of view quite a few questions arise. > > The fact that a minor number of tools from coreutils ended up in > > ubase and one from util-linux in sbase is clearly because of > > (non-)portability. > > Or insanity on behalf of the FSF. Although I largely share that opinion the mistakes of some other entity does not justify lack of description on the own side. > > The binaries in sbase come from these 16 packages on Debian jessie: > > (...) > > The binaries in ubase come from these 16 packages on Debian jessie: > > (...) > > That's not totally straight-forward :) > > Well, the motivation behind sbase is not to start separating it up into > the same insane packages the FSF came up with. The seperation is certainly a good idea. The TODO is more or less just a list. There is no explanation _why_ these tools should be implemented and vi and sh not. Don't get me wrong, I wouldn't stuff vi in sbase, but I think some motivational words wouldn't hurt. > > Also, some tools in sbase are non-POSIX, but the vast majority is. > > Though, even coreutils just contains a subset of the POSIX utilities, > > see [1], there are 160 utilities listed. > > Most likely it won't make sense to implement all of them, even in the > > long run. > > See the TODO in regard to the motivation behind which tools should be > implemented or not. Please see the paragraph above. I don't see any motivation explained in the TODO, just statements of the form 'that should be done' and 'that should not be done'. > > Over time the list of implemented utilities will grow and sbase will > > suck because it contains a confusing number of utilities. > > There are people who want/need a strict set of POSIX utilities, nothing > > else. > > Why would it suck? There are not really many more utilities I can think > of that should be part of sbase apart from the ones already done and the > ones listed in README. I admit that my argumentation was a bit pedantic at that point, but that was intentional. > I don't know about you, but working on sbase every day, using libutil > and libutf, it's actually quite easy to work with it. Sure, I don't doubt that, but working with something every day does not increase the ability to have an out of the (sbase-)box view. > Projects like toybox go too far integrating each tool too deeply into > the "ecosystem". In sbase, each tool more or less stands for itself. > > > Here are some actions I'd like to discuss: > > * Split sbase in two parts > > + A collection of a subset of POSIX utilities, implemented suckless > > + A collection of portable non-POSIX utilities > > Why do you assume that non-POSIX-utilities suck more in any regard? That's not what I tried to say, sorry I wasn't clear enough. > If you look at LSB or GNU coreutils, one may come to this conclusion, > but the only thing I could imagine is having a special config.mk-flag > to only build the POSIX-tools. That's actually a very nice idea, I did not have that thought. There is indeed no need for a complete split, config.mk-flags for POSIX and non-POSIX partitions of sbase would be totally sufficient and very lightweight. > In any case, based on our tests, sbase beats coreutils in many regards > (UTF-8, sanity, consistency and even correct behaviour in traversals). I don't doubt that at all, sbase is some fine piece of software. > The separation between sbase and ubase is imho a loose concept, and we > even discussed putting sbase and ubase in one repository. As long as some ability for seperation remains, why not. > However, having a set of portable tools and a set of non-portable tools > separated is probably the easiest for package-maintainers to follow. > sbase even runs on old IRIX-systems without issues, and in case we find > a way to implement a tool portably which used to be in ubase, it will be > pushed over to sbase. As simple as that. Sure. > > + A short motivation for each utility in sbase that's not in > > coreutils > > + A short motivation for each utility in ubase that's not in > > util-lin
Re: [dev] Scope of sbase and ubase
Feel free to send a documentation patch.
[dev][general] - Greetings & introduction
Hi all, I'm Antenore Gatta, I have some experience in development and several years in other CS domains. I'm here to learn and I hope to pay back with some good and useful patches. At the moment, I'm mainly working on sbase and I'll submit, very very very soon, a patch for review about the -i option for cp. As I stated, I'm still a newbie, pardon me for my rudeness. -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GIT !d s: !a C++ UL P+++ L+++ E--- W+++ N+++ o-- K- w--- O+ M-- V-- PS+++ PE Y+ PGP t+++ 5++ X R++ tv- b+ DI D++ G e+ h r+++ y --END GEEK CODE BLOCK--
[dev] [surf] CPU burn on bitbucket?
Heyho, can you also use the current surf master to heat up your room when visiting bitbucket[0]? I'm using webkit-2.4.8-r200 from the default gentoo tree. 0: https://bitbucket.org/account/signin/ --Markus
Re: [dev] [surf] CPU burn on bitbucket?
* Markus Teich [2015-03-17 17:49:05 +0100]: > Heyho, > > can you also use the current surf master to heat up your room when visiting > bitbucket[0]? I'm using webkit-2.4.8-r200 from the default gentoo tree. > > 0: https://bitbucket.org/account/signin/ > > --Markus That seems to be a WebKitGTK problem - I see the same with dwb. Florian -- http://www.the-compiler.org | m...@the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/ pgpu3dngv5Y40.pgp Description: PGP signature
[dev][sbase][PATCH] Add -i option to cp command
Hi All, As promised find here after a patch that add the -i option to the cp command. As most of the code comes from OpenBSD, I'm not sure is suitable for suckless ( License/Copyright issues? Style? ). If you have better ideas I'll try to improve it, otherwise I was thinkoing to go ahead with mv as well. Let me know!!! Thanks in advance A.G. --- cp.c | 8 +++- fs.h | 1 + libutil/cp.c | 16 +++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cp.c b/cp.c index 4bba1b5..4e79d8b 100644 --- a/cp.c +++ b/cp.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include +#include #include "fs.h" #include "util.h" @@ -7,7 +8,7 @@ static void usage(void) { - eprintf("usage: %s [-afpv] [-R [-H | -L | -P]] source ... dest\n", argv0); + eprintf("usage: %s [-aifpv] [-R [-H | -L | -P]] source ... dest\n", argv0); } int @@ -22,6 +23,11 @@ main(int argc, char *argv[]) break; case 'f': cp_fflag = 1; + cp_iflag = 0; + break; + case 'i': + cp_iflag = isatty(STDIN_FILENO); + cp_fflag = 0; break; case 'p': cp_pflag = 1; diff --git a/fs.h b/fs.h index 853996d..6f08c5f 100644 --- a/fs.h +++ b/fs.h @@ -21,6 +21,7 @@ enum { extern int cp_aflag; extern int cp_fflag; +extern int cp_iflag; extern int cp_pflag; extern int cp_rflag; extern int cp_vflag; diff --git a/libutil/cp.c b/libutil/cp.c index 135a23f..621a523 100644 --- a/libutil/cp.c +++ b/libutil/cp.c @@ -17,6 +17,7 @@ int cp_aflag = 0; int cp_fflag = 0; +int cp_iflag = 0; int cp_pflag = 0; int cp_rflag = 0; int cp_vflag = 0; @@ -35,10 +36,23 @@ cp(const char *s1, const char *s2, int depth) char buf[PATH_MAX]; DIR *dp; int r; + int c, ch; if (cp_vflag) printf("'%s' -> '%s'\n", s1, s2); - + if ((f2 = fopen(s2, "r"))) { + if (cp_iflag) { + weprintf("overwrite %s (y/n [n])? ", s2); + ch = c = getchar(); + while (c != '\n' && c != EOF) + c = getchar(); + if (ch != 'Y' && ch != 'y') { + cp_status = 1; + return 0; + } + } + } + fclose(f2); r = (cp_HLPflag == 'P' || (cp_HLPflag == 'H' && depth > 0)) ? lstat(s1, &st) : stat(s1, &st); if (r < 0) { -- 2.3.2
[dev] [sbase][patch] untypedef expr, find, test
As is existing style in sbase, get rid of typedefs for user defined types. Still have to do cut and sed. I assume we shouldn't untypedef libutf as that's an external project. -Evan From d22d6fb25f5fced8331b663c5d9eabf2e24f28fc Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 17 Mar 2015 10:59:16 -0700 Subject: [PATCH] untypedef expr, find, test, as is existing style in sbase --- expr.c | 68 +++ find.c | 310 - test.c | 18 ++-- 3 files changed, 197 insertions(+), 199 deletions(-) diff --git a/expr.c b/expr.c index aa2bea8..ef7c303 100644 --- a/expr.c +++ b/expr.c @@ -12,15 +12,15 @@ enum { VAL = CHAR_MAX + 1, GE, LE, NE }; -typedef struct { - char *s; /* iff s is NULL, Val is an integer */ +struct val { + char *s; /* iff s is NULL, val is an integer */ intmax_t n; -} Val; +}; static size_t intlen; static void -enan(Val v) +enan(struct val v) { if (v.s) enprintf(2, "syntax error: expected integer got `%s'\n", v.s); @@ -34,7 +34,7 @@ ezero(intmax_t n) } static char * -valstr(Val val, char *buf, size_t bufsiz) +valstr(struct val val, char *buf, size_t bufsiz) { if (val.s) return val.s; @@ -43,7 +43,7 @@ valstr(Val val, char *buf, size_t bufsiz) } static int -valcmp(Val a, Val b) +valcmp(struct val a, struct val b) { char buf1[intlen], buf2[intlen]; char *astr = valstr(a, buf1, sizeof(buf1)); @@ -59,8 +59,8 @@ valcmp(Val a, Val b) * then return the text matched by it \1 (empty string for no match) * else return number of characters matched (0 for no match) */ -static Val -match(Val vstr, Val vregx) +static struct val +match(struct val vstr, struct val vregx) { regex_t re; regmatch_t matches[2]; @@ -76,7 +76,7 @@ match(Val vstr, Val vregx) if (regexec(&re, str, 2, matches, 0)) { regfree(&re); - return (Val){ (re.re_nsub ? "" : NULL), 0 }; + return (struct val){ (re.re_nsub ? "" : NULL), 0 }; } if (re.re_nsub) { @@ -87,15 +87,15 @@ match(Val vstr, Val vregx) *p = '\0'; d = strtoimax(s, &p, 10); if (*s && !*p) /* string matched by subexpression is an integer */ - return (Val){ NULL, d }; + return (struct val){ NULL, d }; /* FIXME? string is never free()d, worth fixing? * need to allocate as it could be in buf1 instead of vstr.s */ - return (Val){ enstrdup(3, s), 0 }; + return (struct val){ enstrdup(3, s), 0 }; } regfree(&re); str += matches[0].rm_so; - return (Val){ NULL, utfnlen(str, matches[0].rm_eo - matches[0].rm_so) }; + return (struct val){ NULL, utfnlen(str, matches[0].rm_eo - matches[0].rm_so) }; } /* ops points to a stack of operators, opp points to one past the last op @@ -105,9 +105,9 @@ match(Val vstr, Val vregx) * pop operator, pop two values, apply operator, push result */ static void -doop(int *ops, int **opp, Val *vals, Val **valp) +doop(int *ops, int **opp, struct val *vals, struct val **valp) { - Val ret, a, b; + struct val ret, a, b; int op; /* For an operation, we need a valid operator @@ -123,30 +123,30 @@ doop(int *ops, int **opp, Val *vals, Val **valp) switch (op) { case '|': - if ( a.s && *a.s) ret = (Val){ a.s , 0 }; - else if (!a.s && a.n) ret = (Val){ NULL, a.n }; - else if ( b.s && *b.s) ret = (Val){ b.s , 0 }; - else ret = (Val){ NULL, b.n }; + if ( a.s && *a.s) ret = (struct val){ a.s , 0 }; + else if (!a.s && a.n) ret = (struct val){ NULL, a.n }; + else if ( b.s && *b.s) ret = (struct val){ b.s , 0 }; + else ret = (struct val){ NULL, b.n }; break; case '&': if (((a.s && *a.s) || a.n) && ((b.s && *b.s) || b.n)) ret = a; else - ret = (Val){ NULL, 0 }; + ret = (struct val){ NULL, 0 }; break; - case '=': ret = (Val){ NULL, valcmp(a, b) == 0 }; break; - case '>': ret = (Val){ NULL, valcmp(a, b) > 0 }; break; - case GE : ret = (Val){ NULL, valcmp(a, b) >= 0 }; break; - case '<': ret = (Val){ NULL, valcmp(a, b) < 0 }; break; - case LE : ret = (Val){ NULL, valcmp(a, b) <= 0 }; break; - case NE : ret = (Val){ NULL, valcmp(a, b) != 0 }; break; + case '=': ret = (struct val){ NULL, valcmp(a, b) == 0 }; break; + case '>': ret = (struct val){ NULL, valcmp(a, b) > 0 }; break; + case GE : ret = (struct val){ NULL, valcmp(a, b) >= 0 }; break; + case '<': ret = (struct val){ NULL, valcmp(a, b) < 0
Re: [dev] [PATCH] Use git to create dist archives.
On Tue, Mar 17, 2015 at 06:59:50AM +0100, Roberto E. Vargas Caballero wrote: > Why do you suppose that every person making a distribution package is > going to have a git repository?. We use git as our central > repository, but it doesn't mean we force to everyone to use it. I don't, but it's not as if there is any particular stabilization work in st. I see no reason not to grab the latest bug fixes. And anyway, distro packages are usually useless if you're supposed to compile it to configure it, and often out of date with the bug fixes I want. pgpdgfTv3b5t2.pgp Description: PGP signature
Re: [dev][sbase][PATCH] Add -i option to cp command
On Tue, Mar 17, 2015 at 05:54:42PM +0100, anten...@simbiosi.org wrote: > Hi All, > > As promised find here after a patch that add the -i option to the cp command. > As most of the code comes from OpenBSD, I'm not sure is suitable for suckless > ( > License/Copyright issues? Style? ). > If you have better ideas I'll try to improve it, otherwise I was thinkoing to > go ahead with mv as well. Thanks for your work but -i is not desired for any of the tools. I do not see the point. Maybe you can focus on other things in the README that need implementing?
[dev] [st] Support the DECSCUSR CSI escape sequence
--- st.c | 47 ++- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/st.c b/st.c index 836ae21..37da82e 100644 --- a/st.c +++ b/st.c @@ -257,6 +257,7 @@ typedef struct { int ch; /* char height */ int cw; /* char width */ char state; /* focus, redraw, visible */ + int cursor; /* cursor style */ } XWindow; typedef struct { @@ -2173,6 +2174,13 @@ csihandle(void) { case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ tcursor(CURSOR_LOAD); break; + case 'q': /* DECSCUSR -- Set Cursor Style */ + DEFAULT(csiescseq.arg[0], 1); + if (!BETWEEN(csiescseq.arg[0], 0, 6)) { + goto unknown; + } + xw.cursor = csiescseq.arg[0]; + break; } } @@ -3553,16 +3561,36 @@ xdrawcursor(void) { /* draw the new one */ if(xw.state & WIN_FOCUSED) { - if(IS_SET(MODE_REVERSE)) { - g.mode |= ATTR_REVERSE; - g.fg = defaultcs; - g.bg = defaultfg; - } + switch (xw.cursor) { + case 0: // Blinking Block + case 1: // Blinking Block (Default) + case 2: // Steady Block + if(IS_SET(MODE_REVERSE)) { + g.mode |= ATTR_REVERSE; + g.fg = defaultcs; + g.bg = defaultfg; + } - sl = utf8len(g.c); - width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ - ? 2 : 1; - xdraws(g.c, g, term.c.x, term.c.y, width, sl); + sl = utf8len(g.c); + width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ + ? 2 : 1; + xdraws(g.c, g, term.c.x, term.c.y, width, sl); + break; + case 3: /* Blinking Underline */ + case 4: /* Steady Underline */ + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + (term.c.y + 1) * xw.ch - 1, + xw.cw, 1); + break; + case 5: /* Blinking bar */ + case 6: /* Steady bar */ + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + 1, xw.ch); + break; + } } else { XftDrawRect(xw.draw, &dc.col[defaultcs], borderpx + curx * xw.cw, @@ -3987,6 +4015,7 @@ main(int argc, char *argv[]) { xw.l = xw.t = 0; xw.isfixed = False; + xw.cursor = 0; ARGBEGIN { case 'a': -- 2.3.3
Re: [dev][sbase][PATCH] Add -i option to cp command
On 03/17/2015 09:03 PM, Dimitris Papastamos wrote: On Tue, Mar 17, 2015 at 05:54:42PM +0100, anten...@simbiosi.org wrote: Hi All, As promised find here after a patch that add the -i option to the cp command. As most of the code comes from OpenBSD, I'm not sure is suitable for suckless ( License/Copyright issues? Style? ). If you have better ideas I'll try to improve it, otherwise I was thinkoing to go ahead with mv as well. Thanks for your work but -i is not desired for any of the tools. I do not see the point. Maybe you can focus on other things in the README that need implementing? Sure, no problem at all. I saw it in the README, it was a simple one so I've tried. Is there anything quite urgent|interesting|waitingforme task ?
Re: [dev][sbase][PATCH] Add -i option to cp command
On Tue, 17 Mar 2015 21:27:56 +0100 Antenore Gatta wrote: Hey Antenore > Is there anything quite urgent|interesting|waitingforme task ? = ls no (-C), -S, -f, -m, -s, -x = nl no -d, -f, -h, -p sortno -m, -o, -d, -f, -i = xargs no -I, -L, -p, -s, -t, -x Choose what you like. Cheers FRIGN -- FRIGN
Re: [dev][sbase][PATCH] Add -i option to cp command
On 03/17/2015 09:37 PM, FRIGN wrote: = ls no (-C), -S, -f, -m, -s, -x = nl no -d, -f, -h, -p sortno -m, -o, -d, -f, -i = xargs no -I, -L, -p, -s, -t, -x Choose what you like. Perfect!
Re: [dev][sbase][PATCH] Add -i option to cp command
On Tue, Mar 17, 2015 at 09:27:56PM +0100, Antenore Gatta wrote: > On 03/17/2015 09:03 PM, Dimitris Papastamos wrote: > >On Tue, Mar 17, 2015 at 05:54:42PM +0100, anten...@simbiosi.org wrote: > >>Hi All, > >> > >>As promised find here after a patch that add the -i option to the cp > >>command. > >>As most of the code comes from OpenBSD, I'm not sure is suitable for > >>suckless ( > >>License/Copyright issues? Style? ). > >>If you have better ideas I'll try to improve it, otherwise I was thinkoing > >>to > >>go ahead with mv as well. > >Thanks for your work but -i is not desired for any of the tools. I do > >not see the point. > > > >Maybe you can focus on other things in the README that need implementing? > > > Sure, no problem at all. > > I saw it in the README, it was a simple one so I've tried. Yeah it should be removed or mentioned somewhere that those options enclosed in () are undesirable for sbase.
Re: [dev] [st] Support the DECSCUSR CSI escape sequence
Hi, On Tue, Mar 17, 2015 at 09:04:32PM +0100, LemonBoy wrote: > --- > st.c | 47 ++- > 1 file changed, 38 insertions(+), 9 deletions(-) > > diff --git a/st.c b/st.c > index 836ae21..37da82e 100644 > --- a/st.c > +++ b/st.c > @@ -257,6 +257,7 @@ typedef struct { > int ch; /* char height */ > int cw; /* char width */ > char state; /* focus, redraw, visible */ > + int cursor; /* cursor style */ > } XWindow; > > typedef struct { > @@ -2173,6 +2174,13 @@ csihandle(void) { > case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ > tcursor(CURSOR_LOAD); > break; > + case 'q': /* DECSCUSR -- Set Cursor Style */ >From [1], this should be ' ' (space), and we should check that there is a 'q' in the buffer afterwards, or maybe we need to have a special case for that in csiparse. > + DEFAULT(csiescseq.arg[0], 1); > + if (!BETWEEN(csiescseq.arg[0], 0, 6)) { > + goto unknown; > + } > + xw.cursor = csiescseq.arg[0]; > + break; > } > } > [...] I personnaly think this sequence is useless, but if people are actually using it like you told me on IRC, we should probably apply it, once fixed. And at least you are not doing the blinking versions! :) [1] http://vt100.net/docs/vt510-rm/chapter4 -- Ivan "Colona" Delalande
[dev] [st] Support the DECSCUSR CSI escape sequence
--- st.c | 64 +++- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/st.c b/st.c index 836ae21..d8e9b94 100644 --- a/st.c +++ b/st.c @@ -197,14 +197,14 @@ typedef struct { } TCursor; /* CSI Escape sequence structs */ -/* ESC '[' [[ [] [;]] ] */ +/* ESC '[' [[ [] [;]] []] */ typedef struct { char buf[ESC_BUF_SIZ]; /* raw string */ int len; /* raw string length */ char priv; int arg[ESC_ARG_SIZ]; int narg; /* nb of args */ - char mode; + char mode[2]; } CSIEscape; /* STR Escape sequence structs */ @@ -257,6 +257,7 @@ typedef struct { int ch; /* char height */ int cw; /* char width */ char state; /* focus, redraw, visible */ + int cursor; /* cursor style */ } XWindow; typedef struct { @@ -1547,7 +1548,10 @@ csiparse(void) { break; p++; } - csiescseq.mode = *p; + csiescseq.mode[0] = *p; + p++; + if (strchr("q", *p)) + csiescseq.mode[1] = *p; } /* for absolute user moves, when decom is set */ @@ -1985,7 +1989,7 @@ csihandle(void) { char buf[40]; int len; - switch(csiescseq.mode) { + switch(csiescseq.mode[0]) { default: unknown: fprintf(stderr, "erresc: unknown csi "); @@ -2173,6 +2177,19 @@ csihandle(void) { case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ tcursor(CURSOR_LOAD); break; + case ' ': + switch (csiescseq.mode[1]) { + case 'q': /* DECSCUSR -- Set Cursor Style */ + DEFAULT(csiescseq.arg[0], 1); + if (!BETWEEN(csiescseq.arg[0], 0, 6)) { + goto unknown; + } + xw.cursor = csiescseq.arg[0]; + break; + default: + goto unknown; + } + break; } } @@ -3553,16 +3570,36 @@ xdrawcursor(void) { /* draw the new one */ if(xw.state & WIN_FOCUSED) { - if(IS_SET(MODE_REVERSE)) { - g.mode |= ATTR_REVERSE; - g.fg = defaultcs; - g.bg = defaultfg; - } + switch (xw.cursor) { + case 0: /* Blinking Block */ + case 1: /* Blinking Block (Default) */ + case 2: /* Steady Block */ + if(IS_SET(MODE_REVERSE)) { + g.mode |= ATTR_REVERSE; + g.fg = defaultcs; + g.bg = defaultfg; + } - sl = utf8len(g.c); - width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ - ? 2 : 1; - xdraws(g.c, g, term.c.x, term.c.y, width, sl); + sl = utf8len(g.c); + width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ + ? 2 : 1; + xdraws(g.c, g, term.c.x, term.c.y, width, sl); + break; + case 3: /* Blinking Underline */ + case 4: /* Steady Underline */ + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + (term.c.y + 1) * xw.ch - 1, + xw.cw, 1); + break; + case 5: /* Blinking bar */ + case 6: /* Steady bar */ + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + 1, xw.ch); + break; + } } else { XftDrawRect(xw.draw, &dc.col[defaultcs], borderpx + curx * xw.cw, @@ -3987,6 +4024,7 @@ main(int argc, char *argv[]) { xw.l = xw.t = 0; xw.isfixed = False; + xw.cursor = 0; ARGBEGIN { case 'a': -- 2.3.3
[dev] [st] segfault when selecting text
I'm running the last git-st on OpenBSD, and sometimes when I select text, I get a segfault. I created a core and I debugged it, the log is attached. The case of this log, is a situation that I cat a file, and I copy the result. Does anyone know about this problem? Any solution? -- Regards Henrique Lengler No symbol "all" in current context. #0 0x1f3ab70062a5 in getsel () at st.c:970 str = 0x1f3d5b25a000 "Itália\n==\nReligião:\n\n\nA maior religião do país é o Catolicismo Romano, embora essa não seja a\nreligião oficial do estado.\n\nApesar da influência história da igreja católica na soc"... ptr = 0x1f3d5b25a140 "" y = 13 lastx = 115 linelen = 0 gp = (Glyph_ *) 0x1f3d6dcc last = (Glyph_ *) 0x1f3d6dcbfff0 #1 0x1f3ab700794d in brelease (e=Variable "e" is not available. ) at st.c:979 No locals. #2 0x1f3ab700b676 in run () at st.c:3901 ev = {type = 5, xany = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977}, xkey = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, root = 158, subwindow = 0, time = 3830580, x = 771, y = 335, x_root = 772, y_root = 354, state = 272, keycode = 1, same_screen = 1}, xbutton = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, root = 158, subwindow = 0, time = 3830580, x = 771, y = 335, x_root = 772, y_root = 354, state = 272, button = 1, same_screen = 1}, xmotion = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, root = 158, subwindow = 0, time = 3830580, x = 771, y = 335, x_root = 772, y_root = 354, state = 272, is_hint = 1 '\001', same_screen = 1}, xcrossing = { type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, root = 158, subwindow = 0, time = 3830580, x = 771, y = 335, x_root = 772, y_root = 354, mode = 272, detail = 1, same_screen = 1, focus = -538976289, state = 3755991007}, xfocus = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, mode = 158, detail = 0}, xexpose = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, x = 158, y = 0, width = 0, height = 0, count = 3830580}, xgraphicsexpose = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, drawable = 27262977, x = 158, y = 0, width = 0, height = 0, count = 3830580, major_code = 0, minor_code = 771}, xnoexpose = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, drawable = 27262977, major_code = 158, minor_code = 0}, xvisibility = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, state = 158}, xcreatewindow = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, parent = 27262977, window = 158, x = 0, y = 0, width = 3830580, height = 0, border_width = 771, override_redirect = 335}, xdestroywindow = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158}, xunmap = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, from_configure = 0}, xmap = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, override_redirect = 0}, xmaprequest = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, parent = 27262977, window = 158}, xreparent = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, parent = 0, x = 3830580, y = 0, override_redirect = 771}, xconfigure = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, x = 0, y = 0, width = 3830580, height = 0, border_width = 771, above = 1520418423556, override_redirect = 272}, xgravity = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, x = 0, y = 0}, xresizerequest = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, width = 158, height = 0}, xconfigurerequest = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, parent = 27262977, window = 158, x = 0, y = 0, width = 3830580, height = 0, border_width = 771, above = 1520418423556, detail = 272, value_mask = 16131858539135107073}, xcirculate = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, event = 27262977, window = 158, place = 0}, xcirculaterequest = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, parent = 27262977, window = 158, place = 0}, xproperty = {type = 5, serial = 3619, send_event = 0, display = 0x1f3d1bc58000, window = 27262977, atom = 158, time = 0, state = 3830580}, xselectionclear = {type = 5, se
Re: [dev] [st] segfault when selecting text
On Tue, Mar 17, 2015 at 07:38:46PM -0300, Henrique Lengler wrote: > I'm running the last git-st on OpenBSD, What's your HEAD's ID? The reason I ask is because in 246c348, and all the way back to 2fcfea1bf149f839cdbcba5c1efc7c4ce31f6d95 at least, that's a comment line. Are you 28259f5750f0dc7f52bbaf8b746ec3dc576a58ee? If so, then it would be that dereferencing last is the cause, but can't tell without more info. What's particular about you? Your file? Your libraries? Your compiler? Is it still an issue with the latest HEAD? I don't recall ever having a segfault on my end. pgpZbmGNwndrR.pgp Description: PGP signature
Re: [dev] [st] Bugs in scrollback buffer patch
On Sat, Mar 14, 2015 at 01:08:14PM +0100, Roberto E. Vargas Caballero wrote: > > * You can scroll past the top line in the buffer. Fixed with the > > attached diff. > > You can push your changes to the wiki if you want. I will, and again when I fix those two other items. School priorities. Strake rebased the patch onto a more recent version of st and made a few bug fixes. I just fixed tabs and made the terminal not scroll back past the start. It seems to be in vogue to squash patches into one, and lose history. The one on the website purports to be from Alexander Huemer, but the authors are listed as Jochen Sprickerhof and Matthew on the web page, and http://lists.suckless.org/dev/1310/17807.html also mentions v4hn. Do we care here at suckless to preserve that metadata, or is a plain unified diff just fine? Proposed updated patch attached. Regards, Alex Pilon diff --git a/FAQ b/FAQ index 3502c60..62a0a6c 100644 --- a/FAQ +++ b/FAQ @@ -22,12 +22,9 @@ you a list of available terminals, but you’ll most likely switch between xterm st or st-256color. The default value for TERM can be changed in config.h (TNAME). -## How do I scroll back up? +## How to scroll? -Using a terminal multiplexer. - -* `st -e tmux` using C-b [ -* `st -e screen` using C-a ESC +By default, use Shift-PgUp and Shift-PgDn. ## Why doesn't the Del key work in some programs? diff --git a/config.def.h b/config.def.h index 56bae2d..9005fe7 100644 --- a/config.def.h +++ b/config.def.h @@ -7,6 +7,7 @@ */ static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false"; static int borderpx = 2; +static int histsize = 2000; static char shell[] = "/bin/sh"; static char *utmp = NULL; @@ -122,6 +123,8 @@ static Shortcut shortcuts[] = { { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, { MODKEY, XK_Num_Lock,numlock,{.i = 0} }, + { ShiftMask,XK_Page_Up, kscrollup, {.i = -1} }, + { ShiftMask,XK_Page_Down, kscrolldown,{.i = -1} }, }; /* diff --git a/st.c b/st.c index 836ae21..22ca1e1 100644 --- a/st.c +++ b/st.c @@ -83,6 +83,8 @@ char *argv0; #define TRUERED(x) (((x) & 0xff) >> 8) #define TRUEGREEN(x) (((x) & 0xff00)) #define TRUEBLUE(x) (((x) & 0xff) << 8) +#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \ + + histsize + 1) % histsize] : term.line[(y) - term.scr]) enum glyph_attribute { @@ -223,6 +225,9 @@ typedef struct { int col; /* nb col */ Line *line; /* screen */ Line *alt;/* alternate screen */ + Line *hist; /* history buffer */ + int histi;/* history index */ + int scr; /* scroll back */ bool *dirty; /* dirtyness of lines */ TCursor c;/* cursor */ int top; /* topscroll limit */ @@ -314,6 +319,8 @@ typedef struct { /* function definitions used in config.h */ static void clipcopy(const Arg *); static void clippaste(const Arg *); +static void kscrolldown(const Arg *); +static void kscrollup(const Arg *); static void numlock(const Arg *); static void selpaste(const Arg *); static void xzoom(const Arg *); @@ -384,8 +391,8 @@ static void tputtab(int); static void tputc(char *, int); static void treset(void); static void tresize(int, int); -static void tscrollup(int, int); -static void tscrolldown(int, int); +static void tscrollup(int, int, bool); +static void tscrolldown(int, int, bool); static void tsetattr(int *, int); static void tsetchar(char *, Glyph *, int, int); static void tsetscroll(int, int); @@ -566,6 +573,16 @@ xrealloc(void *p, size_t len) { return p; } +void * +xcalloc(size_t n, size_t l) { + void *p; + + if ((p = calloc(n, l)) == NULL) + die("Out of memory\n"); + + return p; +} + char * xstrdup(char *s) { if((s = strdup(s)) == NULL) @@ -671,10 +688,10 @@ y2row(int y) { static int tlinelen(int y) { int i = term.col; - if(term.line[y][i - 1].mode & ATTR_WRAP) + if(TLINE(y)[i - 1].mode & ATTR_WRAP) return i; - while(i > 0 && term.line[y][i - 1].c[0] == ' ') + while(i > 0 && TLINE(y)[i - 1].c[0] == ' ') --i; return i; @@ -730,7 +747,7 @@ selsnap(int mode, int *x, int *y, int direction) { * Snap around if the word wraps around at the end or * beginning of a line. */ - prevgp = &term.line[*y][*x]; + prevgp = &TLINE(*y)[*x]; prevdelim = strchr(worddelimiters, prevgp->c[0]) != NULL; for(;;) { newx = *x + direction; @@ -745,14 +762,14 @@ selsnap(int mode, int *x, int *y, int direction) { yt = *y, xt = *x;
Re: [dev] [st] segfault when selecting text
On Tue, Mar 17, 2015 at 07:28:27PM -0400, Alex Pilon wrote: > The reason I ask is because in 246c348, and all the way back to > 2fcfea1bf149f839cdbcba5c1efc7c4ce31f6d95 at least, that's a comment > line. Are you 28259f5750f0dc7f52bbaf8b746ec3dc576a58ee? If so, then it > would be that dereferencing last is the cause, but can't tell without > more info. > > What's particular about you? Your file? Your libraries? Your compiler? > Is it still an issue with the latest HEAD? I don't recall ever having a > segfault on my end. I was in b746816b78447b9e4a3af7333a4e992eb8d32254, I updated to the last, but the error continue. The compiler I'm using is: $ cc --version cc (GCC) 4.2.1 20070719 I don't know how I can provide something to you about the libs. The new log is attached. Something that may be usefull is the compiling log, so this is what I receive when I run make: -- $ make st build options: CFLAGS = -O2 -pipe -g -std=c99 -pedantic -Wall -Wvariadic-macros -Os -I. -I/usr/include -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/include -I/usr/X11R6/include/freetype2 -DVERSION="0.5" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 LDFLAGS = -g -L/usr/lib -lc -L/usr/X11R6/lib -lm -lX11 -lutil -lXext -lXft -L/usr/X11R6/lib -lfontconfig -lfreetype -lz -L/usr/X11R6/lib -lfreetype -lz CC = cc CC st.c In file included from /usr/X11R6/include/X11/Xlib.h:47, from st.c:25: /usr/X11R6/include/X11/Xfuncproto.h:156:24: warning: ISO C does not permit named variadic macros st.c: In function 'strparse': st.c:2265: warning: implicit declaration of function 'strsep' st.c:2265: warning: assignment makes pointer from integer without a cast st.c: In function 'techo': st.c:2375: warning: comparison is always true due to limited range of data type st.c: At top level: st.c:1040: warning: 'clipcopy' defined but not used CC -o st /usr/X11R6/lib/libX11.so.16.0: warning: strcpy() is almost always misused, please use strlcpy() /usr/X11R6/lib/libX11.so.16.0: warning: strcat() is almost always misused, please use strlcat() /usr/X11R6/lib/libX11.so.16.0: warning: sprintf() is often misused, please use snprintf() -- Regards Henrique Lengler #0 0x0b0c2db06205 in getsel () at st.c:976 str = 0xb0eb7fb6000 "Itália\n==\n\nReligião:\n\n", '�' ... ptr = 0xb0eb7fb6024 '�' ... y = 8 lastx = 94 linelen = 0 gp = (Glyph_ *) 0xb0f0c19 last = (Glyph_ *) 0xb0f0c18fff0 #1 0x0b0c2db078a5 in brelease (e=Variable "e" is not available. ) at st.c:985 No locals. #2 0x0b0c2db0b5d6 in run () at st.c:3946 ev = {type = 5, xany = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977}, xkey = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, root = 158, subwindow = 0, time = 11515896, x = 666, y = 375, x_root = 667, y_root = 394, state = 272, keycode = 1, same_screen = 1}, xbutton = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, root = 158, subwindow = 0, time = 11515896, x = 666, y = 375, x_root = 667, y_root = 394, state = 272, button = 1, same_screen = 1}, xmotion = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, root = 158, subwindow = 0, time = 11515896, x = 666, y = 375, x_root = 667, y_root = 394, state = 272, is_hint = 1 '\001', same_screen = 1}, xcrossing = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, root = 158, subwindow = 0, time = 11515896, x = 666, y = 375, x_root = 667, y_root = 394, mode = 272, detail = 1, same_screen = 1, focus = -538976289, state = 3755991007}, xfocus = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, mode = 158, detail = 0}, xexpose = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, x = 158, y = 0, width = 0, height = 0, count = 11515896}, xgraphicsexpose = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, drawable = 27262977, x = 158, y = 0, width = 0, height = 0, count = 11515896, major_code = 0, minor_code = 666}, xnoexpose = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, drawable = 27262977, major_code = 158, minor_code = 0}, xvisibility = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, window = 27262977, state = 158}, xcreatewindow = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, parent = 27262977, window = 158, x = 0, y = 0, width = 11515896, height = 0, border_width = 666, override_redirect = 375}, xdestroywindow = {type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000, event = 27262977, window = 158}, xunmap = { type = 5, serial = 3055, send_event = 0, display = 0xb0e9c0aa000
Re: [dev] [st] segfault when selecting text
> from st.c:25: > /usr/X11R6/include/X11/Xfuncproto.h:156:24: warning: ISO C does not permit > named variadic macros > st.c: In function 'strparse': > st.c:2265: warning: implicit declaration of function 'strsep' > st.c:2265: warning: assignment makes pointer from integer without a cast > st.c: In function 'techo': Your problem is the commit 72d2accc22 which removed _BSD_SOURCE and introduced _DEFAULT_SOURCE instead, but since strsep is not a POSIX function, each system requires different defines. Can you test to define _BSD_SOURCE also? Regards,
Re: [dev] [st] Bugs in scrollback buffer patch
> > It seems to be in vogue to squash patches into one, and lose history. > The one on the website purports to be from Alexander Huemer, but the > authors are listed as Jochen Sprickerhof and Matthew on the web page, > and http://lists.suckless.org/dev/1310/17807.html also mentions v4hn. I suppose these authors didn't modify the .md file. We can add a note in the .md about them. Regards,
[dev] [st] Support the DECSCUSR CSI escape sequence
- csiescseq.mode = *p; + csiescseq.mode[0] = *p; + p++; + if (strchr("q", *p)) + csiescseq.mode[1] = *p; } The strchr is not needed, you can do something like: csiescseq.mode[0] = *p++; csiescseq.mode[1] = *p; if the string has only one character then csiescseq.mode[1] will have only a '\0', but it is not a problem. And in this way the code is more generic because it can deal with sequences like: CSI num $ l (DECSCPP) [I don't talk about add this sequence is only an example) Regards,