sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 4c3b5b0d20df18dfb914d0732ba96c0617a51c57
parent b119447d2198667e25bad72566581f1f70021417
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Wed,  9 Sep 2009 10:06:38 -0400

bugfix: console mode can't start a message in #initialize

Now that it's a regular buffer, it must act like one. I've moved
the message to #run, where it kinda makes more sense. Also tweaked
a few things.

Diffstat:
M lib/sup/modes/console-mode.rb | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/sup/modes/console-mode.rb b/lib/sup/modes/console-mode.rb
@@ -21,6 +21,7 @@ class Console
 
   def xapian; Index.instance.instance_variable_get :@xapian; end
   def ferret; Index.instance.instance_variable_get :@index; end
+  def special_methods; methods - Object.methods end
 
   ## files that won't cause problems when reloaded
   ## TODO expand this list / convert to blacklist
@@ -67,12 +68,6 @@ class ConsoleMode < LogMode
     super
     @console = Console.new self
     @binding = @console.instance_eval { binding }
-    self << <<EOS
-Sup #{VERSION} console.
-Available commands: #{(@console.methods - Object.methods) * ", "}
-Ctrl-g stops evaluation; 'e' restarts it.
-
-EOS
   end
 
   def execute cmd
@@ -89,13 +84,23 @@ EOS
   end
 
   def prompt
-    BufferManager.ask :console, "eval: "
+    BufferManager.ask :console, ">> "
   end
 
   def run
+    self << <<EOS
+Sup v#{VERSION} console session started.
+Available extra commands: #{(@console.special_methods) * ", "}
+Ctrl-G stops evaluation; 'e' restarts it.
+
+EOS
     while true
-      cmd = prompt or return
-      execute cmd
+      if(cmd = prompt)
+        execute cmd
+      else
+        self << "Console session ended."
+        break
+      end
     end
   end
 end