super+v to paste

This commit is contained in:
Mitchell Hashimoto
2022-05-20 15:52:03 -07:00
parent 439e72536a
commit 92b7488449
2 changed files with 17 additions and 2 deletions

View File

@ -17,7 +17,7 @@ Major Features:
* History, mouse scrolling * History, mouse scrolling
* Line wrap * Line wrap
* Selection, highlighting * Selection, highlighting
* Copy/paste * Copy (paste is done)
* Bold * Bold
* Underline * Underline
* Strikethrough * Strikethrough

View File

@ -380,7 +380,22 @@ fn keyCallback(
defer tracy.end(); defer tracy.end();
_ = scancode; _ = scancode;
_ = mods;
// Paste
if (action == .press and mods.super and key == .v) {
const data = glfw.getClipboardString() catch |err| {
log.warn("error reading clipboard: {}", .{err});
return;
};
if (data.len > 0) {
const win = window.getUserPointer(Window) orelse return;
win.queueWrite(data) catch |err|
log.warn("error pasting clipboard: {}", .{err});
}
return;
}
//log.info("KEY {} {} {} {}", .{ key, scancode, mods, action }); //log.info("KEY {} {} {} {}", .{ key, scancode, mods, action });
if (action == .press or action == .repeat) { if (action == .press or action == .repeat) {