void (@NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) { final Document document = editor.getDocument(); int caretOffset = editor.getCaretModel().getOffset(); if (caretOffset <= 0) { return; } // The main idea is to kill everything between the current line start and caret and the whole previous line. final int caretLine = document.getLineNumber(caretOffset); int start; if (caretLine <= 0) { start = 0; } else { start = document.getLineStartOffset(caretLine - 1); } KillRingUtil.cut(editor, start, caretOffset); }