From: William Morgan Date: Thu, 9 Apr 2009 17:06:36 +0000 (-0400) Subject: add system and atime attributes to buffers X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=f68139cdaae8c3790e63a2828d5cf25f79f2ad84;p=sup add system and atime attributes to buffers --- diff --git a/bin/sup b/bin/sup index d8eee0e..01d9417 100644 --- a/bin/sup +++ b/bin/sup @@ -230,7 +230,7 @@ begin when :kill_buffer bm.kill_buffer_safely bm.focus_buf when :list_buffers - bm.spawn_unless_exists("Buffer List") { BufferListMode.new } + bm.spawn_unless_exists("buffer list", :system => true) { BufferListMode.new } when :list_contacts b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new } b.mode.load_in_background if new diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 2143deb..5991534 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -51,8 +51,8 @@ module Redwood class InputSequenceAborted < StandardError; end class Buffer - attr_reader :mode, :x, :y, :width, :height, :title - bool_reader :dirty + attr_reader :mode, :x, :y, :width, :height, :title, :atime + bool_reader :dirty, :system bool_accessor :force_to_top def initialize window, mode, width, height, opts={} @@ -63,6 +63,8 @@ class Buffer @title = opts[:title] || "" @force_to_top = opts[:force_to_top] || false @x, @y, @width, @height = 0, 0, width, height + @atime = Time.at 0 + @system = opts[:system] || false end def content_height; @height - 1; end @@ -97,6 +99,7 @@ class Buffer @mode.draw draw_status status commit + @atime = Time.now end ## s nil means a blank line! @@ -338,7 +341,7 @@ EOS ## w = Ncurses::WINDOW.new(height, width, (opts[:top] || 0), ## (opts[:left] || 0)) w = Ncurses.stdscr - b = Buffer.new w, mode, width, height, :title => realtitle, :force_to_top => (opts[:force_to_top] || false) + b = Buffer.new w, mode, width, height, :title => realtitle, :force_to_top => opts[:force_to_top], :system => opts[:system] mode.buffer = b @name_map[realtitle] = b diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb index ebdeebe..4ac6551 100644 --- a/lib/sup/logger.rb +++ b/lib/sup/logger.rb @@ -18,7 +18,7 @@ class Logger def make_buf return if @mode.buffer || !BufferManager.instantiated? || !@respawn || @spawning @spawning = true - @mode.buffer = BufferManager.instance.spawn "", @mode, :hidden => true + @mode.buffer = BufferManager.instance.spawn "log", @mode, :hidden => true, :system => true @spawning = false end diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 87cf996..92305c9 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -40,7 +40,7 @@ EOS end def buffer - b, new = BufferManager.spawn_unless_exists("", :hidden => true) { PollMode.new } + b, new = BufferManager.spawn_unless_exists("poll for new messages", :hidden => true, :system => true) { PollMode.new } b end