Skip to content

Commit

Permalink
[refactor] Add message to text_output click callback
Browse files Browse the repository at this point in the history
Message from Picotron containing info about mouse position (mx and my
fields). It will be needed later to write custom callbacks reacting in a
different way based on the mouse position. For example, tree will use it
to check whether user clicked the "node collapse" button.
  • Loading branch information
elgopher committed Nov 24, 2024
1 parent 6077ba6 commit 078f263
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gui/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ local function start_test(item)
local text = printed_lines:line(selected_test_id, line_no)
return find_lua_file_in_text(text) != nil
end,
link_click = function(line_no)
link_click = function(line_no, msg)
local text = printed_lines:line(selected_test_id, line_no)

local file = find_lua_file_in_text(text)
Expand Down
2 changes: 1 addition & 1 deletion gui/text_output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function attach_text_output(parent, el)
function text_output:click(msg)
local line = line_at_mouse_position(msg)
if is_link(line) and el.link_click != nil then
el.link_click(line)
el.link_click(line, msg)
end
end

Expand Down
2 changes: 1 addition & 1 deletion gui/tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function attach_tree(parent_el, el)
is_link = function(line_no)
return true
end,
link_click = function(line_no)
link_click = function(line_no, msg)
selected_line = line_no
el.select(provider:get_node(line_no).id)
end,
Expand Down

0 comments on commit 078f263

Please sign in to comment.