]> git.cworth.org Git - sup/commitdiff
add system and atime attributes to buffers
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 9 Apr 2009 17:06:36 +0000 (13:06 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 9 Apr 2009 17:06:36 +0000 (13:06 -0400)
bin/sup
lib/sup/buffer.rb
lib/sup/logger.rb
lib/sup/poll.rb

diff --git a/bin/sup b/bin/sup
index d8eee0e3215fff5cc52470a4695aef3c561e60d4..01d94172bfa55799a77b807b47407216a0f8b9e1 100644 (file)
--- 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
index 2143debd66166a571734d20cb927d3984ff42b08..59915345b14528f6f059efcb22fa82182b31dab2 100644 (file)
@@ -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
 
index ebdeebe74dc67369342680c2d5a07f56ecadeb34..4ac6551bff21e50ab45704f295d6d930edf1ce6d 100644 (file)
@@ -18,7 +18,7 @@ class Logger
   def make_buf
     return if @mode.buffer || !BufferManager.instantiated? || !@respawn || @spawning
     @spawning = true
-    @mode.buffer = BufferManager.instance.spawn "<log>", @mode, :hidden => true
+    @mode.buffer = BufferManager.instance.spawn "log", @mode, :hidden => true, :system => true
     @spawning = false
   end
 
index 87cf9963796286f73a92f87478c207e23300cfa0..92305c9fde1b25a24e5160e24ffbd17c970b623a 100644 (file)
@@ -40,7 +40,7 @@ EOS
   end
 
   def buffer
-    b, new = BufferManager.spawn_unless_exists("<poll for new messages>", :hidden => true) { PollMode.new }
+    b, new = BufferManager.spawn_unless_exists("poll for new messages", :hidden => true, :system => true) { PollMode.new }
     b
   end