sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 674e06bfd94e9d11b7132f9fecd92b2601020ea0
parent 7c3c9dc123f0a603a0a897c283d6420cc7bb3cc9
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Tue, 19 Feb 2008 09:18:22 -0800

Merge branch 'master' of git+ssh://wmorgan@repo.or.cz/srv/git/sup

Diffstat:
M bin/sup | 11 ++++++++---
M lib/sup/modes/compose-mode.rb | 2 +-
M lib/sup/textfield.rb | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -32,10 +32,11 @@ Usage:
 
 Options are:
 EOS
-  opt :list_hooks, "List all hooks and descriptions thereof, and quit."
-  opt :no_threads, "Turn of threading. Helps with debugging. (Necessarily disables background polling for new messages.)"
+  opt :list_hooks, "List all hooks and descriptions, and quit."
+  opt :no_threads, "Turn off threading. Helps with debugging. (Necessarily disables background polling for new messages.)"
   opt :no_initial_poll, "Don't poll for new messages when starting."
-  opt :search, "Search for threads ", :type => String
+  opt :search, "Search for this query upon startup", :type => String
+  opt :compose, "Compose message to this recipient upon startup", :type => String
 end
 
 if $opts[:list_hooks]
@@ -198,6 +199,10 @@ begin
   
   imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
 
+  if $opts[:compose]
+    ComposeMode.spawn_nicely :to_default => $opts[:compose]
+  end
+
   unless $opts[:no_threads]
     PollManager.start
     SuicideManager.start
diff --git a/lib/sup/modes/compose-mode.rb b/lib/sup/modes/compose-mode.rb
@@ -20,7 +20,7 @@ class ComposeMode < EditMessageMode
   end
 
   def self.spawn_nicely opts={}
-    to = opts[:to] || BufferManager.ask_for_contacts(:people, "To: ") or return
+    to = opts[:to] || BufferManager.ask_for_contacts(:people, "To: ", [opts[:to_default]]) or return
     cc = opts[:cc] || (BufferManager.ask_for_contacts(:people, "Cc: ") or return if $config[:ask_for_cc])
     bcc = opts[:bcc] || (BufferManager.ask_for_contacts(:people, "Bcc: ") or return if $config[:ask_for_bcc])
     subj = opts[:subj] || (BufferManager.ask(:subject, "Subject: ") or return if $config[:ask_for_subject])
diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb
@@ -100,7 +100,7 @@ class TextField
         Ncurses::Form::REQ_NEXT_CHAR
       when Ncurses::KEY_DC
         Ncurses::Form::REQ_DEL_CHAR
-      when Ncurses::KEY_BACKSPACE
+      when Ncurses::KEY_BACKSPACE, 127 # 127 is also a backspace keysym
         Ncurses::Form::REQ_DEL_PREV
       when 1 #ctrl-a
         Ncurses::Form::REQ_BEG_FIELD