]> git.notmuchmail.org Git - sup/blobdiff - bin/sup
rewrap getch in select, handle sigwinch manually
[sup] / bin / sup
diff --git a/bin/sup b/bin/sup
index d52a0ad1f441ad696323d205015984753112810b..2d5de6733fcdf76f1a58caa3d64aadce0c02c143 100755 (executable)
--- a/bin/sup
+++ b/bin/sup
@@ -161,6 +161,7 @@ begin
   Index.load
 
   trap("TERM") { |x| raise "so speaking as i think, i die, i die!" }
+  trap("WINCH") { |x| BufferManager.sigwinch_happened! }
 
   if(s = Redwood::SourceManager.source_for DraftManager.source_name)
     DraftManager.source = s
@@ -228,7 +229,20 @@ begin
       nil
     end
 
-    next unless c
+    if c.nil?
+      if BufferManager.sigwinch_happened?
+        Redwood::log "redrawing screen on sigwinch"
+        BufferManager.completely_redraw_screen
+      end
+      next
+    end
+
+    if c == 410
+      ## this is ncurses's way of telling us it's detected a refresh.
+      ## since we have our own sigwinch handler, we don't do anything.
+      next
+    end
+
     bm.erase_flash
 
     action = begin