https://bugs.kde.org/show_bug.cgi?id=527356
Bug ID: 527356
Summary: No action in the context menu that appears **while
editing** a block actually takes effect. Clicking
**Cut, Copy, Paste, Undo, Redo, Select All, Delete**
(and the spell-check options) closes the menu and
**nothing happens** — nothing reaches the clipboard
Classification: Applications
Product: Marknote
Version First 1.6.0
Reported In:
Platform: Garuda Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: General
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Target Milestone: ---
Created attachment 197294
--> https://bugs.kde.org/attachment.cgi?id=197294&action=edit
Fixes the editing context menu's `onClosed` so pending actions actually run.
Previously **none** of the menu's actions ran: `runOnMenuClose` was overwritten
without ever being called.
# Bug Report
**Product:** Marknote
**Component:** Editor (context menu while editing: `TextFieldContextMenu`)
**Version:** 1.6.0 and current master (verified on `29d1e67`)
**Type:** Functional bug
**Severity:** High — context menu is effectively unusable
## Summary
No action in the context menu that appears **while editing** a block actually
takes effect. Clicking **Cut, Copy, Paste, Undo, Redo, Select All, Delete**
(and the spell-check options) closes the menu and **nothing happens** — nothing
reaches the clipboard, nothing is pasted, nothing is undone.
## Steps to reproduce
1. Open a note and click inside a text block to edit it.
1. Select a piece of text with the mouse.
1. Right-click → the menu with **Cut / Copy / Paste** etc. appears.
1. Click **Copy** (or **Cut**).
1. Paste anywhere else (or check the clipboard).
## Observed behavior
- The menu closes normally, but **no action runs**.
- `Copy`/`Cut`: the clipboard **receives nothing**.
- `Paste`: nothing is inserted into the text.
- `Undo`/`Redo`: nothing happens.
- `Select All`: nothing is selected.
- Spell-check suggestions, *"Add to Dictionary"*, *"Ignore"*: no effect.
## Root cause
In `src/qml/TextFieldContextMenu.qml`, each item stores its action in a
`runOnMenuClose` function so it can be executed **after** the menu closes
(needed because `onClosed` restores selection/cursor before acting):
```qml
onTriggered: {
root.deselectWhenMenuClosed = false;
root.runOnMenuClose = () => { root.target.copy(); };
}
```
But the `onClosed` handler **never calls** `runOnMenuClose()`. The comment says
*"run action, and free memory"*, yet the code merely **overwrites** the
function with an empty one — discarding the action:
```js
// run action, and free memory
try {
runOnMenuClose = () => {}; // overwrites, never executes!
} catch (e) {
console.error(e);
console.trace();
}
runOnMenuClose = () => {};
```
Since `runOnMenuClose` starts as `() => {}` (`onOpened` also resets it), the
result is that **no menu action ever runs**, under any circumstances.
## Expected behavior
Clicking any menu item should run the corresponding action once the menu
closes.
## Fix
Call the function before releasing it — one line:
```js
try {
runOnMenuClose(); // run the pending action
} catch (e) {
console.error(e);
console.trace();
}
runOnMenuClose = () => {}; // then release it
```
File: `src/qml/TextFieldContextMenu.qml` (`onClosed` handler).
## Note
This bug exists on the current **master** — it is not tied to a particular
version or local customization. It affects Cut, Copy, Paste, Undo, Redo, Select
All, Delete, and every spell-check action in the context menu.
--
You are receiving this mail because:
You are watching all bug changes.