From b9c8ecb28dfe7c2bf7bf25761713a35e4a97b49f Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 28 Jun 2013 22:43:32 +0200
Subject: [PATCH] If pad ends leftwards of current right screen border, allow
 pad scrolling to the left, but not to the right.

---
 src/windows.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/windows.c b/src/windows.c
index 181247c..33b9b31 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -295,5 +295,6 @@ extern void shift_active_win (struct WinMeta * wmeta, char dir) {
 
 extern void reset_pad_offset(struct WinMeta * wmeta, uint16_t new_offset) {
 // Apply new_offset to windows pad, if it proves to be sane.
-  if (new_offset >= 0 && new_offset + wmeta->pad.size.x < getmaxx(wmeta->pad.curses_win))
+  if (new_offset >= 0
+      && (new_offset < wmeta->pad_offset || new_offset + wmeta->pad.size.x < getmaxx(wmeta->pad.curses_win)))
     wmeta->pad_offset = new_offset; }
-- 
2.30.2