Sorry, but I forgot the patches ...

On Tue, Sep 04, 2012 at 07:34:29PM +0200, Roberto E. Vargas Caballero wrote:
> Hello,
> 
>       Two new patches for st:
> 
> 0001-Add-newline-to-stderr-message.patch
>       - Fix a typo error in previous patches
> 
> 0001-Check-alternative-screen-before-drawing-box-selectio.patch
>       - Don't paint selection box in the wrong screen.
> 
> Best regards,
>From cb0b3f9fc7692463053b42e50e6874779dbc6bba Mon Sep 17 00:00:00 2001
From: "Roberto E. Vargas Caballero" <k...@shike2.com>
Date: Tue, 4 Sep 2012 19:18:56 +0200
Subject: [PATCH] Add newline to stderr message

---
 st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/st.c b/st.c
index e869890..cdf2498 100644
--- a/st.c
+++ b/st.c
@@ -786,7 +786,7 @@ ttynew(void) {
 		cmdfd = m;
 		signal(SIGCHLD, sigchld);
 		if (opt_io && !(fileio = fopen(opt_io, "w"))) {
-			fprintf(stderr, "Error opening %s:%s",
+			fprintf(stderr, "Error opening %s:%s\n",
 				opt_io, strerror(errno));
 		}
 	}
-- 
1.7.10.4

>From 20290a9974d7cc3b95d5ad68f36f3449183f084b Mon Sep 17 00:00:00 2001
From: "Roberto E. Vargas Caballero" <k...@shike2.com>
Date: Tue, 4 Sep 2012 19:09:29 +0200
Subject: [PATCH] Check alternative screen before drawing box selection

Some programs use the alternative screen (vi, less, ...), whose
content is different of the main screen. If you select text in one of
the screen, you don't wait the box selection is painted in the other
screen, so it is necessary check if the selection was done in the same
screen we are going to paint. Before to this commit, you could do
something like:

	$ LESS="" ls | less
	(select some code)
	q

and selection box remains drawing in the main screen, but the content
of selection keeps text of the alternate screen.
---
 st.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/st.c b/st.c
index 09b0262..e869890 100644
--- a/st.c
+++ b/st.c
@@ -221,6 +221,7 @@ typedef struct {
 	struct {int x, y;} b, e;
 	char *clip;
 	Atom xtarget;
+	bool alt;
 	struct timeval tclick1;
 	struct timeval tclick2;
 } Selection;
@@ -579,6 +580,7 @@ selcopy(void) {
 		}
 		*ptr = 0;
 	}
+	sel.alt = IS_SET(MODE_ALTSCREEN);
 	xsetsel(str);
 }
 
@@ -2076,7 +2078,10 @@ drawregion(int x1, int y1, int x2, int y2) {
 	int ic, ib, x, y, ox, sl;
 	Glyph base, new;
 	char buf[DRAW_BUF_SIZ];
+	bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN);
 
+	if ((sel.alt && !alt) || (!sel.alt && alt))
+		ena_sel = 0;
 	if(!(xw.state & WIN_VISIBLE))
 		return;
 
@@ -2089,7 +2094,7 @@ drawregion(int x1, int y1, int x2, int y2) {
 		ic = ib = ox = 0;
 		for(x = x1; x < x2; x++) {
 			new = term.line[y][x];
-			if(sel.bx != -1 && *(new.c) && selected(x, y))
+			if (ena_sel && *(new.c) && selected(x, y))
 				new.mode ^= ATTR_REVERSE;
 			if(ib > 0 && (!(new.state & GLYPH_SET) || ATTRCMP(base, new) ||
 						  ib >= DRAW_BUF_SIZ-UTF_SIZ)) {
-- 
1.7.10.4

Reply via email to