Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Bug: Duplicate commands #2

Open
zcysxy opened this issue Aug 12, 2021 · 4 comments
Open

Bug: Duplicate commands #2

zcysxy opened this issue Aug 12, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@zcysxy
Copy link

zcysxy commented Aug 12, 2021

Thanks for this nice plugin! It works perfectly when executing, but there are some bugs when creating macros. I think it may be caused by adding duplicate commands.

One bug is showed in the gif below, that is when adding one command, duplicate commands are inserted (notice that multiple decrease opacity commands in the gif are added manually one by one without any problem, and the buggy zoom in insertion was happened when editing the created macro)

macros bug

Another bug is that when adding a new macro (with the former one having duplicate commands), commands in the new macro are inserted into the former one, and are duplicated. Please see the following image

image

@phibr0
Copy link
Owner

phibr0 commented Aug 12, 2021

Could you send me the data.json file inside the plugins folder?

@phibr0 phibr0 self-assigned this Aug 12, 2021
@phibr0 phibr0 added the bug Something isn't working label Aug 12, 2021
@phibr0
Copy link
Owner

phibr0 commented Aug 12, 2021

Until I get to fix the edit functionality I will just "remove it". It will be re-enabled once its fixed

@zcysxy
Copy link
Author

zcysxy commented Aug 12, 2021

I removed the redundant commands directly in the json file, and then everything works normally. And the result json file (without redundant commands) is this:

{
  "macros": [
    {
      "mobileOnly": false,
      "icon": "feather-minimize",
      "commandID": "macro-plugin:mini",
      "commands": [
        "obsidian-hider:toggle-app-ribbon",
        "obsidian-hider:toggle-hider-status",
        "obsidian-focus-mode:toggle-super-focus-mode",
        "sliding-panes-obsidian:toggle-sliding-panes",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-toggle-on-top",
        "obsidian-zoom:zoom-in"
      ],
      "delay": 10,
      "name": "mini"
    },
    {
      "mobileOnly": false,
      "icon": "feather-maximize",
      "commandID": "macro-plugin:maxi",
      "commands": [
        "obsidian-electron-window-tweaker:ewt-toggle-on-top",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-focus-mode:toggle-focus-mode",
        "obsidian-hider:toggle-hider-status",
        "obsidian-hider:toggle-app-ribbon",
        "sliding-panes-obsidian:toggle-sliding-panes",
        "obsidian-zoom:zoom-out"
      ],
      "delay": 10,
      "name": "maxi"
    }
  ]
}

And then I created two new test macros, the result json file is

{
  "macros": [
    {
      "mobileOnly": false,
      "icon": "feather-minimize",
      "commandID": "macro-plugin:mini",
      "commands": [
        "obsidian-hider:toggle-app-ribbon",
        "obsidian-hider:toggle-hider-status",
        "obsidian-focus-mode:toggle-super-focus-mode",
        "sliding-panes-obsidian:toggle-sliding-panes",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-toggle-on-top",
        "obsidian-zoom:zoom-in"
      ],
      "delay": 10,
      "name": "mini"
    },
    {
      "mobileOnly": false,
      "icon": "feather-maximize",
      "commandID": "macro-plugin:maxi",
      "commands": [
        "obsidian-electron-window-tweaker:ewt-toggle-on-top",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-focus-mode:toggle-focus-mode",
        "obsidian-hider:toggle-hider-status",
        "obsidian-hider:toggle-app-ribbon",
        "sliding-panes-obsidian:toggle-sliding-panes",
        "obsidian-zoom:zoom-out"
      ],
      "delay": 10,
      "name": "maxi"
    },
    {
      "mobileOnly": false,
      "icon": "bold-glyph",
      "commandID": "macro-plugin:test-1",
      "commands": [
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "obsidian-electron-window-tweaker:ewt-decrease-opacity",
        "workspace:copy-url",
        "workspace:copy-path"
      ],
      "delay": 10,
      "name": "test-1"
    },
    {
      "mobileOnly": false,
      "icon": "bracket-glyph",
      "commandID": "macro-plugin:test-2",
      "commands": [
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-electron-window-tweaker:ewt-increase-opacity",
        "obsidian-zoom:zoom-in",
        "workspace:copy-url",
        "workspace:copy-path",
        "workspace:copy-path",
        "workspace:copy-path"
      ],
      "delay": 10,
      "name": "test-2"
    }
  ]
}

You can see that I first put some duplicate commands (decrease opacity and increase opacity) in test-1 and test-2 (at that time no error occurred). But then when I added copy-url to test-1, the same command was wrongly inserted into test-2 (later created one). And then when I added copy-path to test-2, three duplicate commands were inserted, and at the same time one command was also inserted into test-1. 😵

@phibr0
Copy link
Owner

phibr0 commented Aug 12, 2021

Thats what I get for coding at 3 am. 🤣

@phibr0 phibr0 moved this to in progress in Obsidian Plugins Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Status: in progress
Development

No branches or pull requests

2 participants