Skip to content

Commit ef34aae

Browse files
committed
First marking then scrolling
1 parent 7eae0be commit ef34aae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/jruby_visualizer/visualizer_main_app.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,13 @@ def mark_selected_line(line_number)
187187
def scroll_ruby_to_selected_ast
188188
@ast_view.selection_model.selected_item_property.add_change_listener do |ast_tree_cell|
189189
start_line = ast_tree_cell.node.position.start_line
190+
# first mark the line then scroll to it
191+
mark_selected_line(start_line)
190192
line_pixels = self.class.pixel_height_of_line
191193
# calculate the actual height of the current line in pixels
192194
scroll_to_pixels = line_pixels * start_line
193195
# scroll to start position of current ast tree cell
194196
@ruby_view.set_scroll_top(scroll_to_pixels)
195-
mark_selected_line(start_line)
196197
end
197198
@ast_view.selection_model.set_selected_item(@ast_view.root)
198199
end

0 commit comments

Comments
 (0)