Re: [dev] [st] 0.1 Feedback - Was: A few small patches

2011-04-05 Thread Antoni Grzymala
Ethan Grammatikidis dixit (2011-04-05, 02:11):

 On 4 Apr 2011, at 7:53 pm, Antoni Grzymala wrote:
 
  That's why I have the mod4-c shortcut – exactly for turning
  opera-copied links into a shift-insert insertable selection.
 
 Ah, you have mod4-c run something which copies clipboard to selection?

Yep, as written two mails up in this subthread:

{ MODKEY, XK_c, spawn, SHCMD(xsel -b -o | xsel -i) },

 There's a little prog in p9p which automatically copies selection to  
 clipboard or the other way around, I forget, but it got into a loop  
 with some other program I needed.

I'm not sure I'd want to have that done automatically, I usually keep
track of both the clipboard and the selection in my mind and find that
quite useful.

  Selection seems to have been treated as X legacy stuff, without ever
  being given much though, unfortunately.
 
 s/Selection/Anything remotely interesting, useful, or flexible/

I suppose that's the ongoing punishment for the original sin of X
killing NeWS :).

-- 
[a]



Re: [dev] [st] 0.1 Feedback - Was: A few small patches

2011-04-05 Thread Rob
On 4 April 2011 16:18, Bryan Bennett bbenn...@gmail.com wrote:
 While I understand wanting applications to adhere to the Unix
 Philosophy, it seems to me that inputting and outputting text
 is what a terminal essentially does and copying  pasting is
 just a small extension of that role. I'd like to see a sane
 way of copying  pasting with the keyboard, rather than
 relying on the mouse for that.

How about something similar to Vimperator's edit-textbox idea?
You hit a key-combo, and the terminal writes what is visible on the
screen to a temporary file, then fires up $EDITOR on said file. You
delete what you don't want, then the rest is inserted into X's
selection.

I've knocked together a quick patch, attached, along with a whitespace
patch that removes trailing whitespace. At the moment, the key-combo
is middle mouse.

The patch is a bit of a bodge too - it doesn't support unicode
characters properly and for the system() call to work, SIGCHLD is reset
temporarily, which could be a problem if the shell dies mid-selection
edit. I'm open to suggestions. Avoid system() entirely?

Also, I wasn't sure how to open $EDITOR in st's terminal itself, if
people are interested I'll give it a go, but for the moment it just
fires up another st to host the editor.

Cheers,
Rob.
diff -r fe61798f04a5 st.c
--- a/st.c	Sun Apr 03 21:40:33 2011 +0200
+++ b/st.c	Tue Apr 05 13:04:11 2011 +0100
@@ -45,7 +45,7 @@
 #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 DEFAULT(a, b) (a) = (a) ? (a) : (b)
+#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
 #define BETWEEN(x, a, b)  ((a) = (x)  (x) = (b))
 #define LIMIT(x, a, b)(x) = (x)  (a) ? (a) : (x)  (b) ? (b) : (x)
 #define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
@@ -57,7 +57,7 @@
CURSOR_SAVE, CURSOR_LOAD };
 enum { CURSOR_DEFAULT = 0, CURSOR_HIDE = 1, CURSOR_WRAPNEXT = 2 };
 enum { GLYPH_SET=1, GLYPH_DIRTY=2 };
-enum { MODE_WRAP=1, MODE_INSERT=2, MODE_APPKEYPAD=4, MODE_ALTSCREEN=8, 
+enum { MODE_WRAP=1, MODE_INSERT=2, MODE_APPKEYPAD=4, MODE_ALTSCREEN=8,
MODE_CRLF=16 };
 enum { ESC_START=1, ESC_CSI=2, ESC_OSC=4, ESC_TITLE=8, ESC_ALTCHARSET=16 };
 enum { SCREEN_UPDATE, SCREEN_REDRAW };
@@ -96,7 +96,7 @@
 
 /* Internal representation of the screen */
 typedef struct {
-	int row;	/* nb row */  
+	int row;	/* nb row */
 	int col;	/* nb col */
 	Line* line;	/* screen */
 	Line* alt;	/* alternate screen */
@@ -125,7 +125,7 @@
 	int ch; /* char height */
 	int cw; /* char width  */
 	char state; /* focus, redraw, visible */
-} XWindow; 
+} XWindow;
 
 typedef struct {
 	KeySym k;
@@ -340,7 +340,7 @@
 	else if((*c1(B7|B6|B5)) == (B7|B6)  b == 1)
 		return 0;
 	else if((*c1(B7|B6|B5|B4)) == (B7|B6|B5) 
-	((b == 1) || 
+	((b == 1) ||
 	((b == 2)  (*c2(B7|B6)) == B7)))
 		return 0;
 	else if((*c1(B7|B6|B5|B4|B3)) == (B7|B6|B5|B4) 
@@ -362,7 +362,7 @@
 		return 2;
 	else if ((c(B7|B6|B5|B4)) == (B7|B6|B5))
 		return 3;
-	else 
+	else
 		return 4;
 }
 
@@ -376,20 +376,20 @@
 		sel.xtarget = XA_STRING;
 }
 
-static inline int 
+static inline int
 selected(int x, int y) {
 	if(sel.ey == y  sel.by == y) {
 		int bx = MIN(sel.bx, sel.ex);
 		int ex = MAX(sel.bx, sel.ex);
 		return BETWEEN(x, bx, ex);
 	}
-	return ((sel.b.y  yy  sel.e.y) || (y==sel.e.y  x=sel.e.x)) 
+	return ((sel.b.y  yy  sel.e.y) || (y==sel.e.y  x=sel.e.x))
 		|| (y==sel.b.y  x=sel.b.x  (x=sel.e.x || sel.b.y!=sel.e.y));
 }
 
 void
 getbuttoninfo(XEvent *e, int *b, int *x, int *y) {
-	if(b) 
+	if(b)
 		*b = e-xbutton.button;
 
 	*x = (e-xbutton.x - BORDER)/xw.cw;
@@ -560,7 +560,7 @@
 	exit(EXIT_FAILURE);
 }
 
-void 
+void
 sigchld(int a) {
 	int stat = 0;
 	if(waitpid(pid, stat, 0)  0)
@@ -574,7 +574,7 @@
 void
 ttynew(void) {
 	int m, s;
-	
+
 	/* seems to work fine on linux, openbsd and freebsd */
 	struct winsize w = {term.row, term.col, 0, 0};
 	if(openpty(m, s, NULL, NULL, w)  0)
@@ -613,7 +613,7 @@
 void
 ttyread(void) {
 	static char buf[BUFSIZ];
-	static int buflen = 0; 
+	static int buflen = 0;
 	char *ptr;
 	char s[UTF_SIZ];
 	int charsize; /* size of utf8 char in bytes */
@@ -669,11 +669,11 @@
 void
 treset(void) {
 	term.c = (TCursor){{
-		.mode = ATTR_NULL, 
-		.fg = DefaultFG, 
+		.mode = ATTR_NULL,
+		.fg = DefaultFG,
 		.bg = DefaultBG
 	}, .x = 0, .y = 0, .state = CURSOR_DEFAULT};
-	
+
 	term.top = 0, term.bot = term.row - 1;
 	term.mode = MODE_WRAP;
 	tclearregion(0, 0, term.col-1, term.row-1);
@@ -705,11 +705,11 @@
 tscrolldown(int orig, int n) {
 	int i;
 	Line temp;
-	
+
 	LIMIT(n, 0, term.bot-orig+1);
 
 	tclearregion(0, term.bot-n+1, term.col-1, term.bot);
-	
+
 	for(i = term.bot; i = orig+n; i--) {
 		temp = term.line[i];
 		term.line[i] = term.line[i-n];
@@ -722,12 +722,12 @@
 	int i;
 	Line temp;
 	LIMIT(n, 0, term.bot-orig+1);
-	
+
 	tclearregion(0, orig, term.col-1, orig+n-1);
-	
-	for(i = orig; i = term.bot-n; i++) { 
+
+	for(i = orig; i = 

Re: [dev] Sup and dmc

2011-04-05 Thread Hank D
I'll look at the source. I don't think I'll be able to accomplish
much, but I really want an email client that isn't total ass.

On Sun, Apr 3, 2011 at 9:23 AM, Ethan Grammatikidis eeke...@fastmail.fm wrote:

 On 3 Apr 2011, at 1:37 pm, Džen wrote:

 I don't know what you guys think, but why not simply return messages
 which contain a text/html attachment to the sender? Maybe like this
 people might learn it someday and trash such shitty MUAs...

 I think some mailing lists do this. Some simply drop all attachments but
 means you can't attach patches. Of course, the ML could just drop text/html
 attachments. The big problem is not attachments but mail which does not have
 a plain-text component.

 You know, we could all say we're using shitty MUAs because we see the
 rendered HTML rather than the plain-text component. ;) Even HTML-only mail
 can be converted to plain text.

 /me mumbles something about suckless and MUA :D




Re: [dev] Sup and dmc

2011-04-05 Thread SHRIZZA
 You know, we could all say we're using shitty MUAs because we see
 the rendered HTML rather than the plain-text component. ;) Even
 HTML-only mail can be converted to plain text.

Solution: use mutt.

In ~/.muttrc:

alternative_order text/plain
auto_view text/html
set mailcap_path=~/.mailcap

And in ~/.mailcap:

text/html; w3m -I %{charset} -T text/html; copiousoutput;

w3m is required for the html-text translation.

 /me mumbles something about suckless and MUA :D

Funny, cause mutt's slogan is, all mail clients suck. This one just sucks 
less.