From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.7.146 with SMTP id d18cs48406ebd; Tue, 12 Jan 2010 12:12:16 -0800 (PST) Received: by 10.224.72.195 with SMTP id n3mr341215qaj.79.1263327136042; Tue, 12 Jan 2010 12:12:16 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 6si14457221qwd.56.2010.01.12.12.12.15; Tue, 12 Jan 2010 12:12:16 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 551B41D788BC; Tue, 12 Jan 2010 15:12:15 -0500 (EST) Received: from mail-yx0-f187.google.com (mail-yx0-f187.google.com [209.85.210.187]) by rubyforge.org (Postfix) with ESMTP id 2DCB0177993D for ; Tue, 12 Jan 2010 15:12:07 -0500 (EST) Received: by yxe17 with SMTP id 17so21755134yxe.33 for ; Tue, 12 Jan 2010 12:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:subject:from:to :date:message-id:user-agent:content-transfer-encoding; bh=goTXpXu4Y8rqir9DHUJ2TdkCmP5p4BlHevnDzia5DZw=; b=dOIA6PwmbZBvbZTywDuoZxwii/bQxSPddncH+Q3849YaKAQVtVA4sfmEw7HAlligl7 HQFOt1gJwQPedVwPASt2+PBkrpx/kPkmTYzA5jQJ1f213UwusgzUUSxdPwU5vWALnFZ0 bNC0QkFRzNczHYQfnFg4dN/8VHeS1wnC98yFk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:date:message-id:user-agent :content-transfer-encoding; b=JBm1QNIEDOuD8eqKsV+wnzApujy8Gm3GByYPhBFT+hwTQRFINSLOu47/+2xRWC1SAS 7LazTSJ3KsNzq5Hy+Ck0XYpwHNtsA8SPluYwvCdLHrjUka6ME9WNrZE6wiC8F36sOd1b pidrSmTUJK0ACjQsmOW7Qm3eV6gU/OLGxou88= Received: by 10.150.108.23 with SMTP id g23mr9409449ybc.207.1263327126772; Tue, 12 Jan 2010 12:12:06 -0800 (PST) Received: from localhost (c-76-98-110-216.hsd1.nj.comcast.net [76.98.110.216]) by mx.google.com with ESMTPS id 7sm11128884yxg.32.2010.01.12.12.12.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 12 Jan 2010 12:12:06 -0800 (PST) From: Eric Sherman To: sup-devel Date: Tue, 12 Jan 2010 15:12:04 -0500 Message-Id: <1263327054-sup-3431@changeling.local> User-Agent: Sup/git Subject: [sup-devel] [PATCH] [issue44] cursor sticks to thread X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org 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. --- lib/sup/modes/thread-index-mode.rb | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index a5bd344..9e70ec8 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -219,6 +219,10 @@ EOS end def update + ## remember the thread we are on and where the cursor is before we update + old_cursor_thread = cursor_thread + old_cursor_position = curpos + @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 @@ -226,6 +230,11 @@ EOS @size_widget_width = @size_widgets.max_of { |w| w.display_length } end + ## if the thread moved on screen, move the cursor to its new position + new_cursor_position = @threads.index(old_cursor_thread)||0 + (old_cursor_position..(new_cursor_position-1)).each { |x| cursor_down } + (new_cursor_position..(old_cursor_position-1)).each { |x| cursor_up } + regen_text end -- 1.6.6 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel