fix: disable Ctrl+C exit, copy works via textarea native
This commit is contained in:
@@ -17,8 +17,8 @@ All notable changes to this project will be documented in this file.
|
||||
- **Multi-select delete**: Double-click to enter selection mode, click to toggle selection, batch delete support
|
||||
- **Title truncation**: Long titles in the list display with ellipsis
|
||||
- **Time display**: Format "time · month/day/year", e.g., "12:45 · 4/11/2026"
|
||||
- **Copy to clipboard**: Press Ctrl+C to copy current note (title + content)
|
||||
- **Exit**: Press Ctrl+D to exit (replaces default Ctrl+C)
|
||||
- **Copy**: In edit mode, use Shift+Arrow to select text, then Ctrl+C to copy
|
||||
- **Exit**: Press Ctrl+D to exit
|
||||
|
||||
### Technical
|
||||
|
||||
@@ -39,6 +39,7 @@ npm run build # Build to mio.exe
|
||||
|
||||
### Keyboard Shortcuts
|
||||
|
||||
- `Ctrl+C` - Copy current note to clipboard
|
||||
- `Shift+Arrow` - Select text in edit mode
|
||||
- `Ctrl+C` - Copy selected text (in edit mode)
|
||||
- `Ctrl+D` - Exit application
|
||||
- `Esc` - Exit application (alternative)
|
||||
@@ -77,20 +77,10 @@ function App() {
|
||||
|
||||
const selectedNote = selectedId ? notes.find((n) => n.id === selectedId) : null;
|
||||
|
||||
const handleCopy = () => {
|
||||
if (selectedNote) {
|
||||
const text = `${selectedNote.title}\n\n${selectedNote.content}`;
|
||||
process.stdout.write('\x1b]52;c;' + btoa(text) + '\x07');
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.ctrl && key.name === "d") {
|
||||
process.exit(0);
|
||||
}
|
||||
if (key.ctrl && key.name === "c") {
|
||||
handleCopy();
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -114,5 +104,5 @@ function App() {
|
||||
);
|
||||
}
|
||||
|
||||
const renderer = await createCliRenderer();
|
||||
const renderer = await createCliRenderer({ exitOnCtrlC: false });
|
||||
createRoot(renderer).render(<App />);
|
||||
Reference in New Issue
Block a user