Skip to content

Commit

Permalink
still recurse into substructure on single click
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Oct 16, 2023
1 parent ccaf1fb commit a336f5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
9 changes: 5 additions & 4 deletions docs/gui/gm-editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ This editor allows you to inspect or modify almost anything in DF. Press
:kbd:`?` for in-game help.

Select a field and hit :kbd:`Enter` or double click to edit, or, for structured
fields, to inspect their contents. Right click or hit :kbd:`Esc` to go back to
the previous structure you were inspecting. Right clicking when viewing the
structure you started with will exit the tool. Hold down :kbd:`Shift` and right
click to exit, even if you are inspecting a substructure, no matter how deep.
fields, hit :kbd:`Enter` or single click to inspect their contents. Right click
or hit :kbd:`Esc` to go back to the previous structure you were inspecting.
Right clicking when viewing the structure you started with will exit the tool.
Hold down :kbd:`Shift` and right click to exit, even if you are inspecting a
substructure, no matter how deep.

If you just want to browse without fear of accidentally changing anything, hit
:kbd:`Ctrl`:kbd:`D` to toggle read-only mode. If you want `gui/gm-editor` to
Expand Down
12 changes: 11 additions & 1 deletion gui/gm-editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,17 @@ function GmEditorUi:set(key,input)
self:updateTarget(true)
end
function GmEditorUi:onInput(keys)
if GmEditorUi.super.onInput(self, keys) then return true end
if GmEditorUi.super.onInput(self, keys) then
local index = self.subviews.list_main:getIdxUnderMouse()
if keys._MOUSE_L and index then
local trg = self:currentTarget()
local trg_type = type(trg.target[trg.keys[index]])
if trg_type == 'userdata' or trg_type == 'table' then
self:editSelected(index)
end
end
return true
end

if keys.LEAVESCREEN or keys._MOUSE_R then
if dfhack.internal.getModifiers().shift then
Expand Down

0 comments on commit a336f5c

Please sign in to comment.