commit f68139cdaae8c3790e63a2828d5cf25f79f2ad84
parent e93167f4b73635d28d88226fdbba7ac42373d3df
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Thu, 9 Apr 2009 13:06:36 -0400
add system and atime attributes to buffers
Diffstat:
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git 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
@@ -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
@@ -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
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -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