sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 1f27696ece2634d612cc92c428657ce3e46c0cc5
parent b79a2871ef11306a506df95476f4515c26b6c1d4
Author: Eric Sherman <hyperbolist@gmail.com>
Date:   Tue, 12 Jan 2010 15:36:13 -0500

keep cursor on current thread when threads are added/removed

The cursor will track the thread it is on when that thread is moved up
or down on the screen as threads are added or removed from the view.

Diffstat:
M lib/sup/modes/thread-index-mode.rb | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -220,12 +220,14 @@ EOS
   end
 
   def update
+    old_cursor_thread = cursor_thread
     @mutex.synchronize do
       ## let's see you do THIS in python
       @threads = @ts.threads.select { |t| !@hidden_threads[t] }.sort_by { |t| [t.date, t.first.id] }.reverse
       @size_widgets = @threads.map { |t| size_widget_for_thread t }
       @size_widget_width = @size_widgets.max_of { |w| w.display_length }
     end
+    set_cursor_pos @threads.index(old_cursor_thread)||curpos
 
     regen_text
   end