marktext: CTRL+Z not working

Description

Pressing CTRL+Z doesn’t do anything.

Steps to reproduce

  1. Type some text
  2. Delete some text
  3. CTRL+Z

Expected behavior: That the deleting text gets undone

Actual behavior: Nothing happens

Versions

  • Mark Text: v 0.11.42
  • OS: Windows 10

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Same here. In Linux, CTRL+Z doesn’t undo no matter what. But CTRL+Super+Z seems to work. And then again, CTRL+Shift+Z doesn’t redo at all. It’s strange to see these very commonly used functions not working as expected.

P.S, : Great work on MarkText! Straight off one of the best looking markdown editor I’ve ever used. Felt like a gift from heaven when I found this while searching for .md editors. ❤️

Is there soon a way to fix the error. With version 0.16.2 it still occurs but only in Source Code Mode! Is there a workaround for it?

Hi,

It’s not ok in my computer. When I do Ctrl + Z I got a message that told me that changes will lost if I do not save them.

Keyboard: azerty (french)

Regards.

Thanks @clrh and @stefnotch, I can confirm the issue on Linux and Windows and we’ll fix the issue as soon as possible.

@clrh Which operating system do you use?

I just tested it (Windows 10) and can confirm this issue with the French keyboard layout.

It’s probably because w <–> z (qwerty <–> azerty)

@stefnotch @rgomez90 @dibyadas

I’m happy to announce that we solved the keybinding issue. Could you please check whether everything is ok on your machine. Maybe we have to improve the solution, particularly relating non US-keyboards. Prebuilt binaries for Linux and Windows are available here. Please see PR #543 for more information.

Thanks!

I recently installed MarkTest and I’m having this issue, not being able to undo via shortcut. It does not matter how long I wait or/and type, undo via shortcut never works.

@Jocs Here you go. 2018-05-31_12-04-36

So, here is a GIF where I’m doing the following things

  1. typing some text
  2. using the File->Undo and File->Redo options
  3. pressing CTRL+Z
  4. using File->Undo which doesn’t appear to do anything at all
  5. using File->Undo which does undo the typing

I think that the issue is that CTRL+Z is interpreted as me typing some text instead of as a shortcut.

Unfortunately, it’s a problem in a third-party library dependency (keyboardevent-from-electron-accelerator or keyboardevents-areequal) with wrong virtual key mapping and it’s also a little bit inconsistent. E.g.

France keyboard: Ctrl+W and Ctrl+Z:

Cltr+W

raw accelerator (correct accelerator):
{ code: 'KeyZ', // virtual key
    key: 'w',   // actual key
    altKey: false,
    shiftKey: false,
    metaKey: false,
    ctrlKey: true }

we receive:
{ ctrlKey: true, key: 'w', code: 'KeyW' }

Cltr+Z

raw accelerator (correct accelerator):
 { code: 'KeyW',
    key: 'z',
    altKey: false,
    shiftKey: false,
    metaKey: false,
    ctrlKey: true }

we receive:
{ ctrlKey: true, key: 'w', code: 'KeyW' }

German keyboard: Both Ctrl+Z and Ctrl+Y are interpreted as Ctrl+Z .

The good part of this is that we already forked the library and we could just change the virtual keys at runtime. Well, let me see…

OK, did a quick check and I think Ctrl+Z is a duplicate of https://github.com/marktext/marktext/issues/216 because I can press Ctrl+Super+Z to undo on Linux. And I can confirm the double menu undo bug if the cursor is not at the end of the line. If the cursor is at the end of the line everything is OK.

Edit: replace “end of the line” with “end of the text you inserted”

e.g. aaaaa, then insert bbb (aaabbbaa). The cursor have to be after the last b because each cursor position change is tracked as a undo-operation.