From 2bb440465cef869581b64e467bb2872fa1e6810f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 16 Oct 2023 01:13:54 -0700 Subject: [PATCH] still recurse into substructure on single click --- docs/gui/gm-editor.rst | 9 +++++---- gui/gm-editor.lua | 12 +++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/gui/gm-editor.rst b/docs/gui/gm-editor.rst index df3f616546..080c49b98e 100644 --- a/docs/gui/gm-editor.rst +++ b/docs/gui/gm-editor.rst @@ -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 diff --git a/gui/gm-editor.lua b/gui/gm-editor.lua index 90de0e9567..86cf6c3879 100644 --- a/gui/gm-editor.lua +++ b/gui/gm-editor.lua @@ -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