summaryrefslogtreecommitdiff
path: root/src/keys.cc
diff options
context:
space:
mode:
authorEnrico Zandomeni Borba <enricozb@gmail.com>2024-08-04 09:16:15 +0200
committerEnrico Zandomeni Borba <enricozb@gmail.com>2024-08-04 17:40:29 +0200
commit7093f142916d1e6887432dfd88697a1c2ed1b004 (patch)
tree527df8c4b4bf1adde97a730665baad99457dde8c /src/keys.cc
parent10ed78fe8a580b3558348746ee53f81c5b0aeae1 (diff)
add scroll coordinates
adds scroll amount in the upper 16-bits of `Key.modifiers`, reclaiming the space in `Key.key` for coordinates. Previously, while mouse events included their coordinates, scrolling did not. Scroll events are now emitted as <scroll:amount:line.column>.
Diffstat (limited to 'src/keys.cc')
-rw-r--r--src/keys.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/keys.cc b/src/keys.cc
index 5ba44181..ad66658a 100644
--- a/src/keys.cc
+++ b/src/keys.cc
@@ -7,6 +7,7 @@
#include "utf8_iterator.hh"
#include "utils.hh"
#include "string_utils.hh"
+#include "terminal_ui.hh"
namespace Kakoune
{
@@ -196,7 +197,7 @@ String to_string(Key key)
else if (key.modifiers & Key::Modifiers::MouseRelease)
res = format("mouse:release:{}:{}.{}", key.mouse_button(), coord.line, coord.column);
else if (key.modifiers & Key::Modifiers::Scroll)
- res = format("scroll:{}", static_cast<int>(key.key));
+ res = format("scroll:{}:{}.{}", key.scroll_amount(), coord.line, coord.column);
else if (key.modifiers & Key::Modifiers::Resize)
res = format("resize:{}.{}", coord.line, coord.column);
else