]> git.cworth.org Git - sup/commitdiff
patch to move save-to-disk from logmode to textmode, from marcus williams
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 15:58:09 +0000 (15:58 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 15:58:09 +0000 (15:58 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@700 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/modes/log-mode.rb
lib/sup/modes/text-mode.rb

index 8daa75e6a1e4bf87549ec473e70865534f896d95..de16b5e6635b988fa90329b7d66ef046d3793372 100644 (file)
@@ -3,7 +3,6 @@ module Redwood
 class LogMode < TextMode
   register_keymap do |k|
     k.add :toggle_follow, "Toggle follow mode", 'f'
-    k.add :save_to_disk, "Save log to disk", 's'
   end
 
   def initialize
@@ -37,11 +36,6 @@ class LogMode < TextMode
     end
   end
 
-  def save_to_disk
-    fn = BufferManager.ask_for_filename :filename, "Save log to file: "
-    save_to_file(fn) { |f| f.puts text } if fn
-  end
-
   def status
     super + " (follow: #@follow)"
   end
index be3bc1107952bae9e8c1ab9340bdbce1c2f57a00..bc5be8c225292b7aa913788c9ddb9070d3ffd967 100644 (file)
@@ -2,6 +2,9 @@ module Redwood
 
 class TextMode < ScrollMode
   attr_reader :text
+  register_keymap do |k|
+    k.add :save_to_disk, "Save to disk", 's'
+  end
 
   def initialize text=""
     @text = text.normalize_whitespace
@@ -9,6 +12,11 @@ class TextMode < ScrollMode
     buffer.mark_dirty if buffer
     super()
   end
+  
+  def save_to_disk
+    fn = BufferManager.ask_for_filename :filename, "Save to file: "
+    save_to_file(fn) { |f| f.puts text } if fn
+  end
 
   def text= t
     @text = t