Kouhei Sutou
kous****@users*****
Wed May 10 17:20:41 JST 2006
Index: kazehakase/data/ext/ruby/kz/ruby-dialog.rb diff -u kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.6 kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.7 --- kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.6 Wed May 10 15:32:38 2006 +++ kazehakase/data/ext/ruby/kz/ruby-dialog.rb Wed May 10 17:20:41 2006 @@ -11,7 +11,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copyED of the GNU General Public License +# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # @@ -130,8 +130,11 @@ adjustment ||= Gtk::Adjustment.new(@@history.size, 0, @@history.size, 1, 4, 0) @history_spin = Gtk::SpinButton.new(adjustment, 1, 0) - @history_spin.signal_connect("value-changed") do |widget, type| - update_input_entry if widget.value < @@history.size + @history_spin.signal_connect_after("value-changed") do |widget, type| + @last_history_index ||= @@history.size + @entry_last_text =****@entry***** if @last_history_index == @@history.size + @last_history_index = @history_spin.value.to_i + update_input_entry false end update_widget_font(@history_spin) @@ -146,11 +149,13 @@ end end update_widget_font(@entry, nil, "monospace") + @entry_last_text = nil @entry end def update_input_entry - @entry.text = @@history[@history_spin.value] + index = @history_spin.value.to_i + @entry.text = @@history[index] || @entry_last_text || "" @entry.position = -1 end @@ -228,7 +233,6 @@ handled = false if @history_spin.value > 0 @history_spin.value -= 1 - update_input_entry handled = true end handled @@ -237,7 +241,6 @@ def next_history handled = false if @history_spin.value < @@history.size - update_input_entry @history_spin.value += 1 handled = true end