summaryrefslogtreecommitdiff
blob: cb7ca5b0b0ab4e383ba96c0e8ae6ff251f9095f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 049a3bfdfc59590a24dfeefa707abb64b74ae17b Mon Sep 17 00:00:00 2001
From: Amadeusz Sławiński <amade@asmblr.net>
Date: Fri, 18 Apr 2014 18:28:39 +0000
Subject: do proper checks if we are on altscreen or not

fixes screen segfaults with `altscreen on` when using applications making
use of altscreen like mc when resizing screen window

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
---
diff --git a/src/ansi.c b/src/ansi.c
index 04c9012..e76eef4 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1436,14 +1436,17 @@ int c, intermediate;
 		{
 		  if (i)
 		    {
-		      if (!curr->w_alt.on)
+		      if (!curr->w_alt.on) {
 			SaveCursor(&curr->w_alt.cursor);
-		      EnterAltScreen(curr);
+			EnterAltScreen(curr);
+		      }
 		    }
 		  else
 		    {
-		      LeaveAltScreen(curr);
-		      RestoreCursor(&curr->w_alt.cursor);
+		      if (curr->w_alt.on) {
+		        LeaveAltScreen(curr);
+		        RestoreCursor(&curr->w_alt.cursor);
+		      }
 		    }
 		  if (a1 == 47 && !i)
 		    curr->w_saved.on = 0;
--
cgit v0.9.0.2