sup

A curses threads-with-tags style email client

ncursesw-ruby.git

git clone https://supmua.dev/git/ncursesw-ruby/
commit f552ce89bef492ac4fffd2558d85fae941d4fbe0
parent 27e09c1c2c162851dfe9cf4aab1683c869dc03f6
Author: Gaute Hope <eg@gaute.vetsj.com>
Date:   Mon, 27 Jan 2014 09:08:40 +0100

read_line.rb: compatible with ruby 1.9 and 2.0

Diffstat:
M examples/read_line.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/read_line.rb b/examples/read_line.rb
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 # Emacs: This is -*- ruby -*- code!
-# 
+#
 # Unfinished read_line function
 #
 # Written 2003, 2004 by Tobias Peters
@@ -33,7 +33,7 @@ def read_line(y, x,
       cursor_pos = [0, cursor_pos-1].max
       window.mvaddstr(y, x+string.length, " ")
     # when etc...
-    when " "[0]..255 # remaining printables
+    when " ".ord..255 # remaining printables
       if (cursor_pos < max_len)
         string[cursor_pos,0] = ch.chr
         cursor_pos += 1
@@ -43,8 +43,8 @@ def read_line(y, x,
     else
       Ncurses.beep
     end
-  end    	
-end    
+  end
+end
 
 if (__FILE__ == $0) then begin
   # demo mode
@@ -54,13 +54,13 @@ if (__FILE__ == $0) then begin
 
   # recognize KEY_ENTER, KEY_BACKSPACE  etc
   Ncurses.keypad(Ncurses.stdscr, true)
-  
+
   y = 10
   x = 2
   prompt = "Hallo > "
   Ncurses.mvaddstr(y,x, prompt)
   s = read_line(y, x + prompt.length)
-  
+
 ensure
   Ncurses.endwin
 end end