sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit fc80f81db4138ae624d9a12619b11c03d3a058ae
parent 8e09d8b759a06fa1b81f8efa05d68d015b91aaea
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date:   Fri,  1 Jan 2010 12:47:07 -0800

ruby 1.9: use String#ord in ask_getch and ask_yes_or_no

In Ruby 1.9, character literals and the return value from string index
accesses are now themselves strings and need to be converted to integers with
String#ord. This was breaking ask_getch. Integer#ord is defined on Ruby 1.8 so
this won't cause problems there.

Diffstat:
M lib/sup/buffer.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -609,7 +609,7 @@ EOS
   def ask_getch question, accept=nil
     raise "impossible!" if @asking
 
-    accept = accept.split(//).map { |x| x[0] } if accept
+    accept = accept.split(//).map { |x| x.ord } if accept
 
     status, title = get_status_and_title @focus_buf
     Ncurses.sync do
@@ -645,7 +645,7 @@ EOS
   ## returns true (y), false (n), or nil (ctrl-g / cancel)
   def ask_yes_or_no question
     case(r = ask_getch question, "ynYN")
-    when ?y, ?Y
+    when ?y.ord, ?Y.ord
       true
     when nil
       nil