Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made OutputWidget#maybe_open_file give focus to the editor

  • Loading branch information...
commit 0f4e95ded7dd9e46b5da3ed4d241e70bd70f4b52 1 parent 9d16959
@stcrocco authored
Showing with 12 additions and 0 deletions.
  1. +1 −0  lib/ruber/output_widget.rb
  2. +11 −0 spec/output_widget_spec.rb
View
1  lib/ruber/output_widget.rb
@@ -759,6 +759,7 @@ def maybe_open_file idx
ed = Ruber[:main_window].display_document file, display_hints
hide_tool = pinned_down? and Qt::Application.mouse_buttons != Qt::MidButton
Ruber[:main_window].hide_tool self if hide_tool
+ ed.set_focus if ed
ed
end
View
11 spec/output_widget_spec.rb
@@ -1006,6 +1006,17 @@ class << @ow
@ow.send :maybe_open_file, @mod.index(0,0)
end
+ it 'gives focus to the editor' do
+ ed = flexmock{|m| m.should_receive(:set_focus).once}
+ @mw.should_receive(:display_document).once.and_return(ed)
+ @ow.send :maybe_open_file, @mod.index(0,0)
+ end
+
+ it 'doesn\'t attempt to give focus to the editor if no editor is found' do
+ @mw.should_receive(:display_document).once.and_return nil
+ lambda{@ow.send :maybe_open_file, @mod.index(0,0)}.should_not raise_error
+ end
+
it 'does nothing if the Control and/or Shift modifiers are pressed' do
flexmock(@ow).should_receive(:find_filename_in_index).never
flexmock(Ruber::Application).should_receive(:keyboard_modifiers).once.and_return(Qt::ShiftModifier.to_i)
Please sign in to comment.
Something went wrong with that request. Please try again.