From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.28.69 with SMTP id l5cs633962ebc; Fri, 22 Jan 2010 12:22:35 -0800 (PST) Received: by 10.224.99.71 with SMTP id t7mr2250884qan.368.1264191754606; Fri, 22 Jan 2010 12:22:34 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 5si8684502qwg.48.2010.01.22.12.22.34; Fri, 22 Jan 2010 12:22:34 -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 D30C518582DD; Fri, 22 Jan 2010 15:22:33 -0500 (EST) X-Greylist: delayed 449 seconds by postgrey-1.31 at rubyforge.org; Fri, 22 Jan 2010 15:20:37 EST Received: from mail-pz0-f175.google.com (mail-pz0-f175.google.com [209.85.222.175]) by rubyforge.org (Postfix) with ESMTP id 63BA618582F5 for ; Fri, 22 Jan 2010 15:20:37 -0500 (EST) Received: by pzk5 with SMTP id 5so1547346pzk.30 for ; Fri, 22 Jan 2010 12:20:36 -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 :in-reply-to:references:date:message-id:user-agent :content-transfer-encoding; bh=dREwOvPqmAFbMQZySnndcHv7oBtq9bmtPU8WUq80YLk=; b=c86nIYwicRRR91xvXjvh/xACAcF7KpY5AAUh461IjHTiegYgKtk3W1KLOTbQ7XfGqx cv11ucFwIxOBX6Ho5Qof8XQDCFIxGU7eviD6iUfhMismSJvxHqQVwkjgcSDxRocfb4w3 INDokaOmhLAg6lthTpCnwYXxwolOiEcbwbbTc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:in-reply-to:references:date:message-id :user-agent:content-transfer-encoding; b=OOWmBtIjEHDzk+TOLD6wBXdmuHK6LJbVh1N0sPjJwl9aT7FklsBQ87Bo9yNMfF03uO fL0k1wayetr4cbm+0aajTAAOJZc1gJGN71+b83/JMKrtz0Scy6VmII6GqqtRP4emNB/u 4rcThu3sW3+mPTkvpbALwyxV0OLgAfDDRWSBE= Received: by 10.114.189.28 with SMTP id m28mr2293240waf.165.1264191186099; Fri, 22 Jan 2010 12:13: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 22sm2264927pzk.2.2010.01.22.12.13.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 22 Jan 2010 12:13:04 -0800 (PST) From: Eric Sherman To: sup-devel In-reply-to: <1263483819-sup-9886@changeling.local> References: <1263483819-sup-9886@changeling.local> Date: Fri, 22 Jan 2010 15:13:01 -0500 Message-Id: <1264190784-sup-222@changeling.local> User-Agent: Sup/git Subject: Re: [sup-devel] [PATCHv2] idle and unidle updates 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 This is a problematic place for this logic to go, since it appears as if the idle update does not fire when shelled to the editor, and instead fires immediately upon returning. Which ironically is exactly when you're becoming unidle. I'm thinking of an IdleManager with a single public method #ping that can be called here where no_keystrokes_since is being updated. It has a thread that does the threshold checking and relays the updates. This way it's not in the main thread and doesn't block when shelled. Thoughts? Excerpts from Eric Sherman's message of Thu Jan 14 10:45:54 -0500 2010: > --- > bin/sup | 17 +++++++++++++++++ > 1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/bin/sup b/bin/sup > index 19b2a87..0d90d00 100755 > --- a/bin/sup > +++ b/bin/sup > @@ -260,6 +260,10 @@ begin > SearchResultsMode.spawn_from_query $opts[:search] > end > > + IDLE_THRESHOLD = 60 > + no_keystrokes_since = Time.now > + idle = false > + > until Redwood::exceptions.nonempty? || $die > c = begin > Ncurses.nonblocking_getch > @@ -274,9 +278,22 @@ begin > debug "redrawing screen on sigwinch" > BufferManager.completely_redraw_screen > end > + > + if !idle and Time.now.to_i - no_keystrokes_since.to_i >= IDLE_THRESHOLD > + UpdateManager.relay self, :idle, Time.at(no_keystrokes_since) > + idle = true > + end > + > next > end > > + if idle > + UpdateManager.relay self, :unidle, Time.at(no_keystrokes_since) > + idle = false > + end > + > + no_keystrokes_since = Time.now > + > 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. _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel