A misalignment on the support of the "kill" and "yank"

In the MacOS and many linux system, the following hotkey is defined:
Ctrl+k is “kill-to-end-of-line”, but what is killed goes into a buffer that you can later yank back out with Ctrl+y.

In the search panel, the Ctrl+k and Ctrl+y mechanism works. However, the same mechanism breaks in main editor window.

In the main editor, the Ctrl+k is defined, i.e. kill-to-end-of-line. However, when the Ctrl+y is pressed, the content(a line of text) that has been killed and buffered in the search panel is pasted. And the content in the main editor is killed without being buffered, i.e. the content is deleted.

This misalignment is annoying. Especially for the people, like me, who is used to the ctrl-k and ctrl-y mechanism and use this mechanism system wide.

-----update------
The “kill” and “yank” mechanism also exists in the title area in the edit window. However, it is not available in the edit area.

Mar-21-2021 13-31-48

Kill and yank are new to me, neat!

Do you mind recording this behaviour to demonstrate the problem?

thuis may depend by codemirror

Since it’s not used this way on Windows, I wonder how much per OS tweaking will be practicable.
afaics it’s tackled on a feature by feature basis, with some stuff hanging over from Codemirror without particular intent.

OK. I just recorded a .mov file with macOS’s build-in screen capture app. But how I can upload this mov file?

@Dor
I’m not a developer, so I will not make any comments on the discussion of the cause of this issue. Just speaking about using the Obsidian (for Mac), I think this issue is special: right now, ctrl-k will behave in a manner that break the continuity within this app. That is the reason why I think it may be an issue need to be addressed.

Ctrl+k is “kill-to-end-of-line”, but what is killed goes into a buffer that you can later yank back out with Ctrl+y.

Generally speaking, it works similar to cut and paste.

The difference is that, kill will cut everything at the right of the cursor till the end of the line( i.e. to the /newline mark) without the need to make a selection at first.

Since there is no need to move the mouse to make a selection of the text, It is a mechanism works much more efficiently with keyboard.


Test Case 1

“kill” in the search panel and “yank” in the search panel.

Result:

  1. “kill” works
  2. the buffer is updated with killed content
  3. “yank” works with updated buffer

Test Case 2

“kill” in the search panel and “yank” in the Editor

Result:

  1. “kill” works
  2. the buffer is updated with killed content
  3. “yank” works with updated buffer.

Test Case 3

“kill” in the Editor and “yank” in the Editor

Result:

  1. “kill” works
  2. the buffer is NOT updated with killed content
  3. “yank” works with old buffer.

You can drag and drop, though I think the forum may require .gif format. Sorry for the trouble!

An alternative for recording a demonstration is to find a mac which is running Obsidian and try the 3 test cases above on the Obsidian. I think the 3 test cases may show this problem pretty clear.

1 Like

Yeah, I think those repro instructions should be pretty clear. The devs have access to Macs so the real question is when they’ll have the chance to work on this. Thanks for reporting it, though!

@GLight
I reviewed this issue a bit. This is part of the so called emacsy style shortcuts that are present in some MacOS applications. Ctrl-Y hasn’t been implemented by codemirror. You can go in their repro and open a feature request there.

1 Like

I posted the issue at the codemirror link provided. Here is a link to the issue if others want to chime in over there. This is a rather annoying bug in the editor. I use CTRL-k and CTRL-y profusely.

By the way, why does CTRL-k/y work fine in the title bar and in search and fine-replace dialogs but fails only in the editor (where unfortunately it would be most useful)?

I’m also sorely missing the yank functionality.

The codemirror issue has been closed as the functionality is included in the CodeMirror emacs.js keymap.

I’m still getting up to speed on obsidian internals - is there anyway to activate that emacs keymap in Obsidian?