metasm/gui/gtk.rb in metasm-1.0.3 vs metasm/gui/gtk.rb in metasm-1.0.4
- old
+ new
@@ -126,17 +126,22 @@
end
def resize_child(cld, w, h)
pk = query_child_packing(cld)
if h <= 0
- pk[0] = true
+ if pk[0] != true
+ pk[0] = true
+ set_child_packing(cld, *pk)
+ end
h = 1
else
- pk[0] = false
+ if pk[0] == true
+ pk[0] = false
+ set_child_packing(cld, *pk)
+ end
end
return if h == cld.allocation.height
- set_child_packing(cld, *pk)
cld.set_height_request(h)
end
def redraw
end
@@ -580,24 +585,27 @@
@textwidget.signal_connect('key_press_event') { |w, ev|
key = DrawableWidget::Keyboard_trad[ev.keyval]
case key
when :escape
+ @history_off = @history.length
response(RESPONSE_REJECT)
true
when :enter
+ @history.pop if @history.last == ''
@history << @textwidget.buffer.text.to_s
@history.pop if @history.last == ''
@history.pop if @history.last == @history[-2]
+ @history_off = @history.length
response(RESPONSE_ACCEPT)
true
when :up, :down
txt = @textwidget.buffer.text.to_s
if (@history_off < @history.length or @history.last != txt)
@history[@history_off] = txt
end
@history_off += (key == :up ? -1 : 1)
- @history_off %= @history.length
+ @history_off %= (@history.length > 0 ? @history.length : 1)
@textwidget.buffer.text = @history[@history_off].to_s
text_select_all
end
}