Re: [dev] st patches and clipboard issues

2015-01-02 Thread FRIGN
On Thu, 1 Jan 2015 21:19:24 -0500
Philip Rushik prus...@gmail.com wrote:

Hey Philip,

 Also, the other issue I want to report is that st does not work with
 synergy's clipboard sharing feature.

did you try enabling the Elevated mode in the client (should be
selectable at the bottom of the main window)?

Cheers

FRIGN

-- 
FRIGN d...@frign.de



[dev] st patches and clipboard issues

2015-01-01 Thread Philip Rushik
Hi everybody,

I started using st at work on my work computers. At work we all use
linux boxes supplied by the company and we don't get full control over
them. I love st, I think it is by far the nicest terminal emulator
available, however, I needed scroll back and copy paste support to
play nice with some of the work software that we use, on of them being
synergy. So, I downloaded st 0.5 and attempted to apply the scroll
back and clipboard paste patches from suckless.org, however, clipboard
patch applies with no issues, but appears to have no effect, and the
scrollback patch fails to apply most of the patch.
I took a look at the patch and figured out what it was trying to do
and made the modifications manually and got it to compile. I am
working on preparing a patch that will apply the changes to the latest
version of st if it will be helpful, however, if an updated patch
already exists, then I will forget about it. All I really have to do
is have it not include the other changes I made and it should be good
to go.

Also, the other issue I want to report is that st does not work with
synergy's clipboard sharing feature. I know the X11 clipboard isn't
wonderful, so normally I would just chalk it up to a sucky clipboard
implementation, or something with synergy. However, synergy's
clipboard seems to work with all other applications, and st exhibits
strange behavior. It actually pastes correctly the first time you try
to paste after the application is opened, then nothing happens after
that, even if the clipboard is cleared and something else it copied.
The same goes for the X11 selection paste as well. For this reason I
think it is a bug in st, even though it is only happening with
synergy.
Anything copied from the same an application on the same machine works
fine, but anything copied from the remote machine using synergy fails
to work correctly.

I have attempted to figure this out, but the mechanism st uses seems
so simple and correct according to what I know of the X11 protocol, so
I can't figure it out However, somebody here might know st better
than I do.

That's all I have to say, if you guys want that patch, let me know.
Also, correct me if I am wrong but I think the clipboard patch on
suckless.org is obsolete because it's been merged already into st-0.5.
Not sure what should be done, but seeing the patch on the site is
misleading.

Regards,
--Philip



Re: [dev] st patches and clipboard issues

2015-01-01 Thread CustaiCo
On Thu, Jan 01, 2015 at 09:19:24PM -0500, Philip Rushik wrote:
 I have attempted to figure this out, but the mechanism st uses seems
 so simple and correct according to what I know of the X11 protocol, so
 I can't figure it out However, somebody here might know st better
 than I do.

You can do some testing with xclip[0] which allows you to manipulate
the clipboard and also see requests made to xclip from X to see
what's going on. If run with the -quiet flag it will stay in the
foreground and notify you of every request it gets. That way you can
see if the clipboard sharing program is passing on the requests to the x
client that currently has the selection.

Or just attach a debugger to st and see what's different between the
first requests that work and the second ones that don't. That might be
even easier.

CustaiCo

[0] http://sourceforge.net/projects/xclip/



Re: [dev] st patches and clipboard issues

2015-01-01 Thread Philip Rushik
 You can do some testing with xclip[0] which allows you to manipulate
 the clipboard and also see requests made to xclip from X to see
 what's going on. If run with the -quiet flag it will stay in the
 foreground and notify you of every request it gets. That way you can
 see if the clipboard sharing program is passing on the requests to the x
 client that currently has the selection.

I have xclip installed, but the -quiet flag doesn't seem to work as
you say it should.

 Or just attach a debugger to st and see what's different between the
 first requests that work and the second ones that don't. That might be
 even easier.

Yeah, but its something that would be tough to do during work. I'll
see what I can do though.


 st with scrollback: https://github.com/strake/st

Ok, I figured it already existed. I bother with the patch then.



Re: [dev] st patches and clipboard issues

2015-01-01 Thread M Farkas-Dyck
st with scrollback: https://github.com/strake/st



Re: [dev] [st] Patches

2012-10-07 Thread Aurélien Aptel
I don't think the DEC alignment test is necessary. Please read LEGACY
in st repo.



Re: [dev] [st] Patches

2012-10-07 Thread Christoph Lohmann
Hello.

On Sun, 07 Oct 2012 11:10:50 +0200 Aurélien Aptel aurelien.ap...@gmail.com 
wrote:
 I don't think the DEC alignment test is necessary. Please read LEGACY
 in st repo.

I applied the patch for it to have a reason to modularize the tsetchar()
function. I think this will be needed for  another  feature  I  have  in
mind.  Then the test loop will be removed.


Sincerely,

Christoph Lohmann




Re: [dev] [st] Patches

2012-10-07 Thread Roberto E. Vargas Caballero
On Sun, Oct 07, 2012 at 11:10:21AM +0200, Aurélien Aptel wrote:
 I don't think the DEC alignment test is necessary. Please read LEGACY
 in st repo.


I duded about this, but like I was not sure I sent the patch to the list in
order to begin a discussion about this. You can see that the message in the
commit was very clear about the sequence maybe was not necessary.



Re: [dev] [st] Patches

2012-10-07 Thread Roberto E. Vargas Caballero
 I applied the patch for it to have a reason to modularize the tsetchar()
 function. I think this will be needed for  another  feature  I  have  in
 mind.  Then the test loop will be removed.

Uhmmm, you could say me this and it was very easy for me split the patch and
keep only that part. Next time I will try split this kind of patches.



Re: [dev] [st] Patches

2012-10-07 Thread Christoph Lohmann
Hello.

On Sun, 07 Oct 2012 11:55:50 +0200 Roberto E. Vargas Caballero 
k...@shike2.com wrote:
  I applied the patch for it to have a reason to modularize the tsetchar()
  function. I think this will be needed for  another  feature  I  have  in
  mind.  Then the test loop will be removed.
 
 Uhmmm, you could say me this and it was very easy for me split the patch and
 keep only that part. Next time I will try split this kind of patches.

You  didn’t  do anything wrong. Patches should normally create full fea‐
tures instead of just frameworks. So your patch is right.


Sincerely,

Christoph Lohmann




Re: [dev] [st] Patches

2012-09-20 Thread Roberto E. Vargas Caballero

 Yeah! Oh, we could have a variable for everything that one could wish
 to start in st: STTMUX, STGNUSCREEN, STAALIBKDE...

 or we could just use -e.

Yeah, even when you start it from a menu like dmenu or it is automatically
spawned from a graphical application. It's true that a boolean variable may
not be the best solution, but -e also it is not the solution. Maybe a better
aproach can be a variable with the parameters for st (like LESS variable) or
something like this.



Re: [dev] [st] Patches

2012-09-20 Thread Peter Hartman
how is -e not a solution?

2012/9/20 Roberto E. Vargas Caballero k...@shike2.com:

 Yeah! Oh, we could have a variable for everything that one could wish
 to start in st: STTMUX, STGNUSCREEN, STAALIBKDE...

 or we could just use -e.

 Yeah, even when you start it from a menu like dmenu or it is automatically
 spawned from a graphical application. It's true that a boolean variable may
 not be the best solution, but -e also it is not the solution. Maybe a better
 aproach can be a variable with the parameters for st (like LESS variable) or
 something like this.




-- 
sic dicit magister P
Université du Québec à Montréal / Loyola University Chicago
http://individual.utoronto.ca/peterjh
gpg 1024D/ED6EF59B (7D1A 522F D08E 30F6 FA42 B269 B860 352B ED6E F59B)
gpg --keyserver pgp.mit.edu --recv-keys ED6EF59B



Re: [dev] [st] Patches

2012-09-20 Thread Roberto E. Vargas Caballero
 how is -e not a solution?

Uhmmm, I suck ^^!. dmenu allows you write the full command line, so you can
use -e with it.



[dev] [st] Patches

2012-09-19 Thread Roberto E. Vargas Caballero
Hi,

A new serie of patches for st. Please send comments or suggestions.

Best regards.
From 703b3cfc0cdb4998abca6815dd32699705a9f912 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 19 Sep 2012 19:42:48 +0200
Subject: Clear X window in tsetreset()

tsetreset() is called when it is necessary a full initialization of the
terminal, so it also should clean the full X window and not only the
terminal content. It is necessary change the order of the
initialization in main(), and put xinit before of tnew(), because tnew() 
calls to tsetreset(), and  this can cause a call to xreset() with
incorrect values.
---
 st.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/st.c b/st.c
index 35f6f16..7c05a6c 100644
--- a/st.c
+++ b/st.c
@@ -943,6 +943,7 @@ treset(void) {
 		term.tabs[i] = 1;
 	term.top = 0, term.bot = term.row - 1;
 	term.mode = MODE_WRAP;
+	xclear(0, 0, xw.w, xw.h);
 	tclearregion(0, 0, term.col-1, term.row-1);
 }
 
@@ -2445,9 +2446,9 @@ main(int argc, char *argv[]) {
 
  run:
 	setlocale(LC_CTYPE, );
+	xinit();
 	tnew(80, 24);
 	ttynew();
-	xinit();
 	selinit();
 	run();
 	return 0;
-- 
1.7.10.4

From 4671ab2615b1bd5f6e77bd8ec24765707b5f Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 19 Sep 2012 19:46:40 +0200
Subject: Remove unused parameters in ttyresize

---
 st.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/st.c b/st.c
index 7c05a6c..43dbe32 100644
--- a/st.c
+++ b/st.c
@@ -283,7 +283,7 @@ static void tfulldirt(void);
 
 static void ttynew(void);
 static void ttyread(void);
-static void ttyresize(int, int);
+static void ttyresize(void);
 static void ttywrite(const char *, size_t);
 
 static void xdraws(char *, Glyph, int, int, int, int);
@@ -890,7 +890,7 @@ ttywrite(const char *s, size_t n) {
 }
 
 void
-ttyresize(int x, int y) {
+ttyresize(void) {
 	struct winsize w;
 
 	w.ws_row = term.row;
@@ -2339,7 +2339,7 @@ resize(XEvent *e) {
 	xclear(0, 0, xw.w, xw.h);
 	tresize(col, row);
 	xresize(col, row);
-	ttyresize(col, row);
+	ttyresize();
 }
 
 void
-- 
1.7.10.4

From b42c8e533bdbb694b35ba3d0ef74863e51c8808e Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 19 Sep 2012 19:49:48 +0200
Subject: Add KAM sequence

This sequence lock/unlock the keyboard ignoring all the key pressing events
from X server.
---
 st.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/st.c b/st.c
index 43dbe32..7e369c7 100644
--- a/st.c
+++ b/st.c
@@ -107,7 +107,8 @@ enum term_mode {
 	MODE_MOUSEBTN= 32,
 	MODE_MOUSEMOTION = 64,
 	MODE_MOUSE   = 32|64,
-	MODE_REVERSE = 128
+	MODE_REVERSE = 128,
+	MODE_KBDLOCK = 256
 };
 
 enum escape_state {
@@ -1319,6 +1320,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
 			}
 		} else {
 			switch(*args) {
+			case 2:
+MODBIT(term.mode, set, MODE_KBDLOCK);
+break;
 			case 4:
 MODBIT(term.mode, set, MODE_INSERT);
 break;
@@ -2269,6 +2273,8 @@ kpress(XEvent *ev) {
 	int shift;
 	Status status;
 
+	if (IS_SET(MODE_KBDLOCK))
+		return;
 	meta = e-state  Mod1Mask;
 	shift = e-state  ShiftMask;
 	len = XmbLookupString(xw.xic, e, buf, sizeof(buf), ksym, status);
-- 
1.7.10.4

From fada4a6e23741745b85f8c60eacd8bbcf07d7483 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 19 Sep 2012 20:00:56 +0200
Subject: Fix LNM sequence

LNM sequence is a standard ANSI mode, not a DEC private mode.
---
 st.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/st.c b/st.c
index 7e369c7..4dd7547 100644
--- a/st.c
+++ b/st.c
@@ -1283,9 +1283,6 @@ tsetmode(bool priv, bool set, int *args, int narg) {
 			case 7:
 MODBIT(term.mode, set, MODE_WRAP);
 break;
-			case 20:
-MODBIT(term.mode, set, MODE_CRLF);
-break;
 			case 12: /* att610 -- Start blinking cursor (IGNORED) */
 break;
 			case 25:
@@ -1326,6 +1323,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
 			case 4:
 MODBIT(term.mode, set, MODE_INSERT);
 break;
+			case 20:
+MODBIT(term.mode, set, MODE_CRLF);
+break;
 			default:
 fprintf(stderr,
 	erresc: unknown set/reset mode %d\n,
-- 
1.7.10.4

From e328b3e0cf5db77cb3e37500cbed097d5477e117 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 19 Sep 2012 20:18:15 +0200
Subject: Add some documentetion to tsetmode

The names of the terminal modes supported by vt102 are (taken from the VT220
programmer reference manual):

Table 4-7 ANSI-Standardized Modes
Name  Mnemonic		Parameter (Ps)
Error (ignored)		- 0 (3/0)
Keyboard action		KAM	  2 (3/2)
Insert/replace		IRM	  4 (3/4)
Send/receive		SRM	  12 (3/1 3/2)
Line feed/new line	LNM   20 (3/2 3/0)

Table 4-8 ANSI-Compatible DEC Private Modes
Name  Mnemonic		  Parameter (Ps)
Error (ignored)		  -	0 (3/0)
Cursor key		  DECCKM  

Re: [dev] [st] Patches

2012-09-19 Thread Martti Kühne
On Wed, Sep 19, 2012 at 8:42 PM, Roberto E. Vargas Caballero
k...@shike2.com wrote:
 Hi,

 A new serie of patches for st. Please send comments or suggestions.

 Best regards.


Would you also port st to wayland?

cheers!
mar77i



Re: [dev] [st] Patches

2012-09-19 Thread pancake
How many patches are left to get scrollback buffer?

On Sep 19, 2012, at 20:42, Roberto E. Vargas Caballero k...@shike2.com 
wrote:

 Hi,
 
A new serie of patches for st. Please send comments or suggestions.
 
 Best regards.
 0001-Clear-X-window-in-tsetreset.patch
 0002-Remove-unused-parameters-in-ttyresize.patch
 0003-Add-KAM-sequence.patch
 0004-Fix-LNM-sequence.patch
 0005-Add-some-documentetion-to-tsetmode.patch



Re: [dev] [st] Patches

2012-09-19 Thread Peter Hartman
2012/9/19 pancake panc...@youterm.com:
 How many patches are left to get scrollback buffer?

We don't want scrollback buffers.
-- 
sic dicit magister P
Université du Québec à Montréal / Loyola University Chicago
http://individual.utoronto.ca/peterjh
gpg 1024D/ED6EF59B (7D1A 522F D08E 30F6 FA42 B269 B860 352B ED6E F59B)
gpg --keyserver pgp.mit.edu --recv-keys ED6EF59B



Re: [dev] [st] Patches

2012-09-19 Thread Nick
Quoth Peter Hartman:
 2012/9/19 pancake panc...@youterm.com:
  How many patches are left to get scrollback buffer?
 
 We don't want scrollback buffers.

Some of us do.



Re: [dev] [st] Patches

2012-09-19 Thread hiro
Just use 9term.



Re: [dev] [st] Patches

2012-09-19 Thread Roberto E. Vargas Caballero
Well... I was asking about comments and suggestion of the patches. I am not
the person who can accept or deny new suggestion, but I am going to give my
personal opinion.

 Would you also port st to wayland?

I think in case of being possible, st is very far to do this, because it has
a lot of things to fix before.

 How many patches are left to get scrollback buffer?

Idea of main developers is not add this feature to st, because you can get
it using other external programs, like for example tmux. This helps to keep
st very simple, efficient and clear. Maybe a good solution could be
integrate tmux inside of st (for example if STTMUX is defined, run tmux in
starup).



Re: [dev] [st] Patches

2012-09-19 Thread Strake
On 19/09/2012, Roberto E. Vargas Caballero k...@shike2.com wrote:
 Maybe a good solution could be
 integrate tmux inside of st (for example if STTMUX is defined, run tmux in
 starup).

Yeah! Oh, we could have a variable for everything that one could wish
to start in st: STTMUX, STGNUSCREEN, STAALIBKDE...

or we could just use -e.



[dev] [st] Patches

2012-09-17 Thread Roberto E. Vargas Caballero
Some new patches for st.
From 17025c9ab88bb8560bac3896c2384ad060c6e8d9 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Mon, 17 Sep 2012 19:03:35 +0200
Subject: Add xcalloc wrapper

malloc and realloc are called through xmalloc and xrealloc, so calloc should
be called through xcalloc.
---
 st.c |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/st.c b/st.c
index d5ecf61..df7f8d8 100644
--- a/st.c
+++ b/st.c
@@ -324,6 +324,7 @@ static int isfullutf8(char *, int);
 
 static void *xmalloc(size_t);
 static void *xrealloc(void *, size_t);
+static void *xcalloc(size_t nmemb, size_t size);
 
 static void (*handler[LASTEvent])(XEvent *) = {
 	[KeyPress] = kpress,
@@ -373,6 +374,14 @@ xrealloc(void *p, size_t len) {
 	return p;
 }
 
+void *
+xcalloc(size_t nmemb, size_t size) {
+	void *p = calloc(nmemb, size);
+	if(!p)
+		die(Out of memory\n);
+	return p;
+}
+
 int
 utf8decode(char *s, long *u) {
 	uchar c;
@@ -1801,8 +1810,8 @@ tresize(int col, int row) {
 	/* allocate any new rows */
 	for(/* i == minrow */; i  row; i++) {
 		term.dirty[i] = 1;
-		term.line[i] = calloc(col, sizeof(Glyph));
-		term.alt [i] = calloc(col, sizeof(Glyph));
+		term.line[i] = xcalloc(col, sizeof(Glyph));
+		term.alt [i] = xcalloc(col, sizeof(Glyph));
 	}
 	if(col  term.col) {
 		bool *bp = term.tabs + term.col;
-- 
1.7.10.4

From cd17e65b475b1eaccc73a2668f67953ac1e4 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Mon, 17 Sep 2012 19:05:06 +0200
Subject: Add newline in error messages

---
 st.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/st.c b/st.c
index df7f8d8..c408ca9 100644
--- a/st.c
+++ b/st.c
@@ -363,14 +363,14 @@ void *
 xmalloc(size_t len) {
 	void *p = malloc(len);
 	if(!p)
-		die(Out of memory);
+		die(Out of memory\n);
 	return p;
 }
 
 void *
 xrealloc(void *p, size_t len) {
 	if((p = realloc(p, len)) == NULL)
-		die(Out of memory);
+		die(Out of memory\n);
 	return p;
 }
 
-- 
1.7.10.4

From b13844523254ef2e05a8c3d81b89b8aba09e3513 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Mon, 17 Sep 2012 20:19:48 +0200
Subject: Copy non set positions as spaces

st selection don't insert in the selection position whose value is not
set. This is correct for the positions in the end of the line, but cause
some problems in the beginning. For example echo -e 'a\tb' will print in the
screen:

a	b

but after selecting and copying in some place you get:

ab

because positions from 1 to 7 don't have any value. This patch deals all
positions without value as blank (even at the end of the line).
---
 st.c |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/st.c b/st.c
index c408ca9..b2e5e22 100644
--- a/st.c
+++ b/st.c
@@ -596,14 +596,17 @@ selcopy(void) {
 		/* append every set  selected glyph to the selection */
 		for(y = 0; y  term.row; y++) {
 			for(x = 0; x  term.col; x++) {
-is_selected = selected(x, y);
-if((term.line[y][x].state  GLYPH_SET)  is_selected) {
-	int size = utf8size(term.line[y][x].c);
-	memcpy(ptr, term.line[y][x].c, size);
-	ptr += size;
-}
+int size;
+char *p;
+Glyph *gp = term.line[y][x];
+
+if(!(is_selected = selected(x, y)))
+	continue;
+p = (gp-state  GLYPH_SET) ? gp-c :  ;
+size = utf8size(p);
+memcpy(ptr, p, size);
+ptr += size;
 			}
-
 			/* \n at the end of every selected line except for the last one */
 			if(is_selected  y  sel.e.y)
 *ptr++ = '\n';
-- 
1.7.10.4

From b6a73e21dfe968a8dbc8736799175a58cd8dfd8b Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Mon, 17 Sep 2012 20:24:19 +0200
Subject: Clean windows display after resizing

Some times the size after a resizing is not an exact multiply of a number of
characters, so redrawn the screen using the lines and columns of the neww
size can cause that some old graphics keep in the screen. Solution is clean
all the windows with the background color.
---
 st.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/st.c b/st.c
index b2e5e22..20e4512 100644
--- a/st.c
+++ b/st.c
@@ -1839,6 +1839,9 @@ void
 xresize(int col, int row) {
 	xw.w = MAX(1, 2*BORDER + col * xw.cw);
 	xw.h = MAX(1, 2*BORDER + row * xw.ch);
+	XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0,
+		   DisplayWidth(xw.dpy, xw.scr),
+		   DisplayHeight(xw.dpy, xw.scr));
 }
 
 void
-- 
1.7.10.4