@mthines/reaper-mcp 0.17.0-beta.18.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -238,7 +238,7 @@ local function count_tracks_in_snapshot(content)
|
|
|
238
238
|
local count = 0
|
|
239
239
|
local depth = 0
|
|
240
240
|
local i = arr_start
|
|
241
|
-
while i <= #arr_start + 50000
|
|
241
|
+
while i <= math.min(#content, arr_start + 50000) do
|
|
242
242
|
local ch = content:sub(i, i)
|
|
243
243
|
if ch == '[' or ch == '{' then
|
|
244
244
|
depth = depth + 1
|
|
@@ -929,11 +929,17 @@ local function draw()
|
|
|
929
929
|
elseif char == 13 then -- Enter = restore
|
|
930
930
|
if selected_idx > 0 and selected_idx <= #snapshots then
|
|
931
931
|
local snap = snapshots[selected_idx]
|
|
932
|
-
local
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
932
|
+
local confirm = reaper.ShowMessageBox(
|
|
933
|
+
"Restore snapshot '" .. snap.name .. "'?\n\nThis will overwrite current mixer state.\nAn undo point will be created.",
|
|
934
|
+
"Restore Snapshot", 1
|
|
935
|
+
)
|
|
936
|
+
if confirm == 1 then
|
|
937
|
+
local ok, err, count = do_restore_snapshot(snap)
|
|
938
|
+
if ok then
|
|
939
|
+
set_status("Restored '" .. snap.name .. "' (" .. (count or "?") .. " tracks)", "ok")
|
|
940
|
+
else
|
|
941
|
+
set_status("Restore failed: " .. (err or "unknown error"), "err")
|
|
942
|
+
end
|
|
937
943
|
end
|
|
938
944
|
end
|
|
939
945
|
elseif char == 6579564 then -- Delete key
|
|
@@ -960,7 +966,9 @@ local function draw()
|
|
|
960
966
|
local wheel = gfx.mouse_wheel
|
|
961
967
|
if wheel ~= 0 then
|
|
962
968
|
local scroll_lines = wheel > 0 and -3 or 3
|
|
963
|
-
|
|
969
|
+
local _, _, _, lh_scroll = get_list_rect()
|
|
970
|
+
local max_scroll_wheel = math.max(0, #snapshots - get_visible_rows(lh_scroll))
|
|
971
|
+
scroll_offset = math.max(0, math.min(scroll_offset + scroll_lines, max_scroll_wheel))
|
|
964
972
|
gfx.mouse_wheel = 0
|
|
965
973
|
end
|
|
966
974
|
|