Skip to content

Conflicts with new EditField text editing keys #5226

@ChrisJohnsen

Description

@ChrisJohnsen

I thought the first two categories had straightforward solutions that weren't too bad, so I put them together in a PR: DFHack/scripts#1383

EditField internal restructuring casualty

  • scripts/internal/gm-unit/editor_civilization.lua CivBox
    • gui/gm-unit, Civilization editor, l (select from list)
    • / is the only special hotkey; it uses a label, but it is not clickable as a workaround!
      • it could easily be made clickable, but many other bits of gm-unit are also not clickable
    • regression: / hotkey
      • 50.15-r2 opens race selection (will be used to filter civ list)
      • 51.03-r1 enters / in search field
    • this is fallout from internal restructuring of EditField; CivBox re-sets its EditField's ignore_keys, but since the new EditField is a wrapper that only reads its ignore_keys at init-time, the changed value is not used
      • if we ignore encapsulation, we can get the desired effect by reaching more deeply into the EditField:
        • re-setting self.subviews.list.edit.text_area.text_area.ignore_keys works

UIs with an occasionally focused EditField

These have player-accessible workarounds (unfocus the EditField). The PR just tries to make it a bit more obvious that certain keys are unavailable while the TextField is focused (add disabled fields that track the EditField's focus state).

  • scripts/gui/autochop.lua Autochop

    • gui/autochop log target field (Ctrl+n: Target number of logs)
    • change Ctrl-u hotkey while log target field is focused
      • 50.15-r2 undesignates all trees
      • 51.03-r1 clears the contents of the log target field
      • probably okay to keep the new behavior since the Ctrl-u hotkey still works when the log target field is not focused
  • scripts/gui/quantum.lua Quantum

    • gui/quantum name field (Ctrl+n: Name)
    • change Ctrl-z hotkey while name field is focused
      • 50.15-r2 toggles "create pile"
      • 51.03-r1 does undo in name field
      • probably okay to keep the new behavior since the Ctrl-z hotkey still works when the name field is not focused
  • scripts/gui/quickfort.lua Quickfort

    • gui/quickfort
      • select a blueprint,
      • use m: Maker label to open marker options,
      • use r: Repeat label to enable an up or down repeat,
      • use R: x label to focus repeat count field
    • change Ctrl-w hotkey while repeat field is focused
      • 50.15-r2 toggles warm dig marker option
      • 51.03-r1 deletes the word (or word part) before the cursor in focused EditField

EditField-centric UIs

These seem to need a bit of design consideration. I didn't see a quick fix that would allow the key to be (conditionally) used by both the EditField and the rest of the UI.

The UIs could probably use ignore_keys to "retain" the hotkey, but that would introduce non-uniformities in the support of the new text editing features.

Or if UI churn is okay, the UIs could switch to new hotkeys (or rearrange things so the EditField is not always focused, though this would be awkward for some of them, especially just to let one hotkey become active).

  • plugins/lua/zone.lua AssignAnimal

    • show_pasture_pond_screen PasturePondOverlay (zone.pasturepond)
      • Ctrl+t: DFHack assign pen/pasture or pit/pond DF zone window
    • show_cage_chain_screen CageChainOverlay (zone.cagechain)
      • Ctrl+t: DFHack assign from cage or chain DF building window
    • most hotkeys are uppercase letters and are excluded from the search EditField with :on_chars
    • clicking on the Ctrl+a: Assign all/none label works, but the corresponding keypress is consumed by the EditField:
      • regression: Ctrl-a hotkey
        • 50.15-r2 assigns all/none
        • 51.03-r1 selects all text in search EditField
  • scripts/gui/civ-alert.lua Civalert

    • gui/civ-alert or click on the configure/gear icon in the civ alert overlay window (gui/civ-alert.big_red_button)
    • clicking on the Ctrl+w: Sound alarm! … label works, but the corresponding keypress is consumed by the burrow filter EditField
    • regression: Ctrl-w hotkey
      • 50.15-r2 enables civ-alert
      • 51.03-r1 deletes the word (or word part) before the cursor in focused (burrow filter) EditField
  • scripts/gui/launcher.lua EditPanel

    • gui/launcher
    • two EditFields: command line, and history search
      • these EditFields can lose focus, but only by giving it to the other EditField? (so, one of them is always focused)
    • clicking on the Ctrl+w: Tags: … label works, but the corresponding keypress is consumed by the focused EditField:
      • regression: Ctrl-w hotkey while either EditField is focused
        • 50.15-r2 opens tag list
        • 51.03-r1 deletes the word (or word part) before the cursor in focused EditField
  • scripts/gui/launcher.lua TagFilterPanel

    • gui/launcher, open the tags panel by clicking on the Ctrl+w: Tags: … label
    • clicking on the Ctrl+a: Cycle all label works, but the corresponding keypress is consumed by the EditField
      • regression: Ctrl-a hotkey
        • 50.15-r2 cycles all tags
        • 51.03-r1 selects all text in search EditField
  • scripts/internal/caravan/movegoods.lua MoveGoods

    • MoveGoodsOverlay (caravan.movegoods)
      • Ctrl+t: DFHack move trade goods from DF trade depot window
    • AssignTradeOverlay (caravan.assigntrade)
      • Ctrl+t: DFHack move trade goods from DF trading interface
    • most hotkeys are uppercase letters and are excluded from the search EditField with :on_chars
    • clicking on the Ctrl+a: Select all/none label works, but the corresponding keypress is consumed by the EditField
      • regression: Ctrl-a hotkey
        • 50.15-r2 selects all trade goods
        • 51.03-r1 selects all text in search EditField
  • scripts/internal/caravan/pedestal.lua AssignItems

    • PedestalOverlay (caravan.displayitemselector)
      • Ctrl+t: DFHack assign from DF display furniture info window
    • most hotkeys are uppercase letters and are excluded from the search EditField with :on_chars
    • clicking on the Ctrl+a: Select all/none label works, but the corresponding keypress is consumed by the EditField
      • regression: Ctrl-a hotkey
        • 50.15-r2 selects all the (filtered) items
        • 51.03-r1 selects all text in search EditField
  • scripts/internal/caravan/trade.lua Trade

    • TradeBannerOverlay (caravan.tradebanner)
      • Ctrl+t: DFHack trade UI from DF trade screen
    • most hotkeys are uppercase letters and are excluded from the search EditField with :on_chars
    • clicking on the Ctrl+a: Select all/none label works, but the corresponding keypress is consumed by the EditField
      • regression: Ctrl-a hotkey
        • 50.15-r2 selects all (filtered) trade goods
        • 51.03-r1 selects all text in search EditField

I know manipulator isn't released yet, but I did notice it has a hotkey conflict (and a couple of instances of "Escape does not cancel like right-click").

  • scripts/gui/manipulator.lua QuickMenu
    • gui/manipulator
      • Ctrl-g Jump to column label
        • should support Esc to exit?
      • U Unhide column label
        • problem Ctrl-a (unhide all) is masked by FilteredList's EditField
        • should support Esc to exit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions