From b4fbf06c572b8647e4de3c3dabd96248cae7df45 Mon Sep 17 00:00:00 2001 From: Mikhail Kot Date: Fri, 12 Jul 2024 21:35:43 +0100 Subject: [PATCH] fix o and O on feedback closed --- internal/definitions/actions.lua | 2 ++ internal/state_machine/state_machine.lua | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/definitions/actions.lua b/internal/definitions/actions.lua index b8015a51..abc5dd86 100644 --- a/internal/definitions/actions.lua +++ b/internal/definitions/actions.lua @@ -157,6 +157,8 @@ return { FitSelectedItemsByStretching = 41206, FitNotes = { 40754, midiCommand = true }, FocusMain = "_S&M_WNMAIN", + FocusTracks = "_BR_FOCUS_TRACKS", + FocusMidiEditor = "_SN_FOCUS_MIDI_EDITOR", FolderChildren = { "SelectFolderChildren", "ScrollToSelectedTracks" }, FolderParent = { "SelectFolderParent", "ScrollToSelectedTracks" }, Folder = { "SelectFolder", "ScrollToSelectedTracks" }, diff --git a/internal/state_machine/state_machine.lua b/internal/state_machine/state_machine.lua index 048ef9a3..3c5d1ce4 100644 --- a/internal/state_machine/state_machine.lua +++ b/internal/state_machine/state_machine.lua @@ -3,6 +3,7 @@ local buildCommand = require('command.builder') local handleCommand = require('command.handler') local getPossibleFutureEntries = require('command.completer') local config = require 'definitions.config'.general +local actions = require 'definitions.actions' local log = require('utils.log') local format = require('utils.format') local feedback = require('gui.feedback.controller') @@ -141,8 +142,12 @@ local function input() feedback.update() -- This works only when window is docked, nothing we can do otherwise - local defocus_window = section_id == 0 and "_BR_FOCUS_TRACKS" or "_SN_FOCUS_MIDI_EDITOR" + local defocus_window = section_id == 0 + and actions.FocusTracks or actions.FocusMidiEditor reaper.Main_OnCommand(reaper.NamedCommandLookup(defocus_window), 0) + + -- When we insert track with feedback window closed, it steals focus and track is not renamed + if hotkey.key:lower() == "o" then reaper.Main_OnCommand(actions.RenameTrack, 0) end end return input