]> git.cworth.org Git - sup/commitdiff
fix garbaged text in textfield when using ncursesw
authorBenoît PIERRE <benoit.pierre@gmail.com>
Wed, 19 Aug 2009 20:56:55 +0000 (22:56 +0200)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sat, 22 Aug 2009 14:56:03 +0000 (10:56 -0400)
Apparently, field_buffer content is not initialized to blanks when using
the wide-character version of ncurses. Forcing a call to
set_field_buffer fix the problem.

lib/sup/textfield.rb

index c748c7a653a6a3405a089c2cfe4149a17ba82de4..f52aa821d3b7ef540dfe2509bba2b998142129a6 100644 (file)
@@ -35,9 +35,9 @@ class TextField
     @completion_block = block
     @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 256, 0
     @form = Ncurses::Form.new_form [@field]
-    @value = default
+    @value = default || ''
     Ncurses::Form.post_form @form
-    set_cursed_value default if default
+    set_cursed_value @value
   end
 
   def position_cursor