3

On Windows, the Redo action in MySQL Workbench is mapped to the Ctrl+Y keyboard shortcut (it looks like it has been so since september 2009). I would like to use Ctrl+Shift+Z. However, pressing this combination prints a SUB character in the current tab, which I interpret as a substitute character.

According to an SO answer, I should be able to change it in the main_menu.xml file. After doing so and restarting MySQL Workbench, the new keyboard shortcut correctly appears in the Edit Menu, but pressing the corresponding keys still echoes a SUB character.

Is there any way to make Ctrl+Shift+Z work?

EDIT:

What I did exactly was:

  • change the shortcut to Modifier+Shift+Z in the element with id="com.mysql.wb.menu.edit.redo"
  • change the shortcut to some other shortcut in the element with id="com.mysql.wb.menu.database.sync_mysql_script" (which was using Modifier+Shift+Z).

You can see it more detailed in Thomas Dickey's answer.

Community
  • 1
  • 1
marcv
  • 1,874
  • 4
  • 24
  • 45
  • 1
    Did you ever get a solution to this issue? I have so many different IDE's and between windows and mac I'm trying to map them all to the same thing and CTRL-SHIFT-Z for redo is what I would like. But after performing the changes you describe I *sometimes* get the same results. I say *sometimes* because if I go to the menu and select Redo the first time, then CTRL-SHIFT-Z seems to work for *some period of time* before reverting to the SUB character. – Lehrian Dec 13 '19 at 22:03
  • IIRC no and this is one of the reasons that made me stop using MySQL Workbench. I now use the sql client embedded in my IDE (Phpstorm /Intellij Idea). – marcv Dec 15 '19 at 11:29

2 Answers2

2

You did not detail what you tried. In main_menu.xml, I see

    <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.edit.redo">
      <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.edit</link>
      <value type="string" key="caption">Redo</value>
      <value type="string" key="name">redo</value>
      <value type="string" key="command">builtin:redo</value>
      <value type="string" key="itemType">action</value>
      <value type="string" key="shortcut">Modifier+Y</value>
      <value type="string" key="platform">windows,linux</value>
    </value>

    <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.edit.redomac">
      <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.edit</link>
      <value type="string" key="caption">Redo</value>
      <value type="string" key="name">redo</value>
      <value type="string" key="command">builtin:redo</value>
      <value type="string" key="itemType">action</value>
      <value type="string" key="shortcut">Modifier+Shift+Z</value>
      <value type="string" key="platform">macosx</value>
    </value>

Those two chunks differ in more than one place, so I would not change the platform value. Changing the line

      <value type="string" key="shortcut">Modifier+Y</value>

to

      <value type="string" key="shortcut">Modifier+Shift+Z</value>

may seem to work. However, there is an existing definition with that binding later in the file (which would conflict if you just made that change):

    <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.database.sync_mysql_script">
      <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.database</link>
      <value type="string" key="caption">Synchronize Model...</value>
      <value type="string" key="name">synchronization</value>
      <value type="string" key="command">plugin:db.mysql.plugin.sync.db</value>
      <value type="string" key="itemType">action</value>
      <value type="string" key="shortcut">Modifier+Shift+Z</value>
      <value type="string" key="platform">windows,linux</value>
      <value type="string" key="context">*model</value>
    </value>

and perhaps you overlooked that.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • What you describe is exactly what I did, and it doesn't produce the expected result. It's as if `Ctrl+Shift+Z` where handled by Windows *before* MySQL Workbench. Anyway, you are completely right about the missing details in my question. I've just edited my question (and shamefully pointed to your very detailed answer). +1 – marcv Jul 04 '15 at 05:38
1

Unfortunately, the keyboard handling in MySQL Workbench is not always centralized. Especially the editor control (Scintilla) has its own keyboard scheme that is not influenced by what is defined in the xml. Probably would make a lot of sense to also set the hotkey in the editor when loading them from the xml.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • Is *"set the hotkey in the editor when loading them from the xml"* something that I can do? – marcv Jul 07 '15 at 07:56