From d6c49459023d6b581cecbe162cb7a78f79584430 Mon Sep 17 00:00:00 2001
From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com>
Date: Sun, 19 Oct 2025 02:32:16 +0500
Subject: [PATCH 1/2] Make the emulation of tmux-like prefix keys more
consistent (example in architecture.md)
---
doc/architecture.md | 32 ++++++++++++++++++--------------
doc/settings.md | 23 +++++++++++++----------
src/netxs/desktopio/ansivt.hpp | 2 +-
src/netxs/desktopio/console.hpp | 5 +++++
src/netxs/desktopio/controls.hpp | 2 +-
src/netxs/desktopio/events.hpp | 3 +++
src/netxs/desktopio/input.hpp | 14 +++++++++++---
src/vtm.xml | 2 +-
8 files changed, 53 insertions(+), 30 deletions(-)
diff --git a/doc/architecture.md b/doc/architecture.md
index a0f916f0c0..ac2be4e96b 100644
--- a/doc/architecture.md
+++ b/doc/architecture.md
@@ -525,21 +525,25 @@ It is possible to emulate the tmux-like keyboard prefix approach by using a glob
```xml
-
diff --git a/doc/settings.md b/doc/settings.md
index df6c5667e9..a6694cd5f2 100644
--- a/doc/settings.md
+++ b/doc/settings.md
@@ -398,7 +398,7 @@ The syntax for defining event bindings is:
```xml
- ` | Binding to an event source using a specific ObjectID.
-`` | Remove all existing bindings for the specified key combination "Key+Chord".
-`` | Do nothing.
+Configuration | Interpretation
+-------------------------------------------------------------|-----------------
+`` | Append existing bindings using an indirect reference (the `ScriptReference` variable without quotes).
+`` | Append existing bindings for `KeyChord | AnotherChord`.
+`` | Append existing bindings with the directly specified Lua script body.
+`` | Binding to an event source using a specific `ObjectID`.
+`` | Remove all existing bindings for the specified key combination `KeyChord`.
+`` | Bypass the `KeyChord` event if something. Works only with non-preview KeyChords.
+`` | Do nothing.
EventId's:
@@ -1143,7 +1146,7 @@ Notes
-
+
diff --git a/src/netxs/desktopio/ansivt.hpp b/src/netxs/desktopio/ansivt.hpp
index 12b890e9f9..f6ddc281c0 100644
--- a/src/netxs/desktopio/ansivt.hpp
+++ b/src/netxs/desktopio/ansivt.hpp
@@ -891,7 +891,7 @@ namespace netxs::ansi
{
auto count = 1;
auto width = 0_sz;
- auto total = std::count(text::begin(), text::end(), '\n');
+ auto total = std::count(text::begin(), text::end(), '\n') + 1;
while (total)
{
total /= 10;
diff --git a/src/netxs/desktopio/console.hpp b/src/netxs/desktopio/console.hpp
index f09462862b..e44272d96b 100644
--- a/src/netxs/desktopio/console.hpp
+++ b/src/netxs/desktopio/console.hpp
@@ -512,6 +512,11 @@ namespace netxs::ui
gear.indexer.expire();
luafx.set_return();
}},
+ { "Bypass", [&]
+ {
+ gear.touched = {};
+ luafx.set_return(true);
+ }},
{ "SetHandled", [&]
{
auto dismiss = luafx.get_args_or(1, faux);
diff --git a/src/netxs/desktopio/controls.hpp b/src/netxs/desktopio/controls.hpp
index 29a696eb60..b89237c4ec 100644
--- a/src/netxs/desktopio/controls.hpp
+++ b/src/netxs/desktopio/controls.hpp
@@ -1759,7 +1759,7 @@ namespace netxs::ui
keybd(base&&) = delete;
keybd(base& boss)
: skill{ boss },
- instance_id{ datetime::now().time_since_epoch().count() }
+ instance_id{ datetime::uniqueid() }
{
boss.LISTEN(tier::general, input::events::die, gear, memo)
{
diff --git a/src/netxs/desktopio/events.hpp b/src/netxs/desktopio/events.hpp
index f94dbd0873..5c9c1fa5c2 100644
--- a/src/netxs/desktopio/events.hpp
+++ b/src/netxs/desktopio/events.hpp
@@ -42,6 +42,7 @@ namespace netxs::events
static constexpr auto mouserelease = __COUNTER__ - counter; // events: Run in subscription order for object tree.
static constexpr auto keybdpreview = __COUNTER__ - counter; // events: Run in subscription order for focused objects.
static constexpr auto keybdrelease = __COUNTER__ - counter; // events: Run in subscription order for focused objects.
+ static constexpr auto keybd_prerun = __COUNTER__ - counter; // events: Run in subscription order for focused objects (fires during keybdpreview stage; subscribers can reset gear.touch if their current keybdrelease subscription is not confirmed).
static constexpr auto unknown = __COUNTER__ - counter; // events: .
static constexpr auto str = std::to_array({ "release"sv,
"preview"sv,
@@ -52,6 +53,7 @@ namespace netxs::events
"mouserelease"sv,
"keybdpreview"sv,
"keybdrelease"sv,
+ "keybd_prerun"sv,
"unknown"sv, });
static constexpr auto order = std::to_array({ feed::fwd,
feed::rev,
@@ -61,6 +63,7 @@ namespace netxs::events
feed::none,
feed::none,
feed::none,
+ feed::none,
feed::none, });
};
diff --git a/src/netxs/desktopio/input.hpp b/src/netxs/desktopio/input.hpp
index ccf0030e4d..36da58ca64 100644
--- a/src/netxs/desktopio/input.hpp
+++ b/src/netxs/desktopio/input.hpp
@@ -2125,6 +2125,7 @@ namespace netxs::input
text chord;
txts sources; // Event source list.
netxs::sptr> script_ptr;
+ netxs::sptr> prerun_ptr;
};
using vector = std::vector;
@@ -2202,13 +2203,14 @@ namespace netxs::input
}
}
}
- auto keybind(base& boss, qiew chord_str, auto&& script_body, txts const& sources = {})
+ auto keybind(base& boss, qiew chord_str, auto&& script_body, netxs::sptr> prerun_body = {}, txts const& sources = {})
{
if (!chord_str) return;
auto [chords, is_preview] = input::bindings::get_chords(chord_str);
if (chords.size())
{
auto script_ptr = ptr::shared(boss.indexer, boss, script_body);
+ auto prerun_ptr = prerun_body ? ptr::shared(boss.indexer, boss, prerun_body) : netxs::sptr{};
auto reset_handler = !(script_ptr->script_body_ptr && script_ptr->script_body_ptr->second.size());
for (auto& binary_chord : chords) if (binary_chord.size()) // Scripts always store their sensors at the boss side, since the lifetime of base::scripting_context depends on the boss.
{
@@ -2237,6 +2239,10 @@ namespace netxs::input
auto event_id = boss.indexer.get_kbchord_hint(binary_chord);
auto tier_id = is_preview ? tier::keybdpreview : tier::keybdrelease;
set_handler(reset_handler, boss, tier_id, event_id, sources, script_ptr);
+ if (prerun_ptr)
+ {
+ set_handler(reset_handler, boss, tier::keybd_prerun, event_id, sources, prerun_ptr);
+ }
}
}
}
@@ -2245,7 +2251,7 @@ namespace netxs::input
{
for (auto& r : bindings)
{
- keybind(boss, r.chord, r.script_ptr, r.sources);
+ keybind(boss, r.chord, r.script_ptr, r.prerun_ptr, r.sources);
}
}
void dispatch(auto& boss, auto& instance_id, hids& gear, si32 tier_id, hint event_id)
@@ -2255,6 +2261,7 @@ namespace netxs::input
&& boss.bell::has_handlers(tier::keybdrelease, event_id))
{
gear.touched = instance_id;
+ boss.base::signal(tier::keybd_prerun, event_id, gear);
}
}
auto load(settings& config, auto& script_list)
@@ -2265,6 +2272,7 @@ namespace netxs::input
//todo revise
//auto script_context = config.settings::push_context(script_ptr);
auto script_body_ptr = ptr::shared(std::pair{ 0, config.settings::take_value(script_ptr) });
+ auto prerun_body_ptr = ptr::shared(std::pair{ 0, config.settings::take_value_from(script_ptr, "prerun", ""s) });
auto on_ptr_list = config.settings::take_ptr_list_of(script_ptr, "on");
for (auto event_ptr : on_ptr_list)
{
@@ -2277,7 +2285,7 @@ namespace netxs::input
// log("chord='%%' \tpreview=%% source='%%' script=%%", on_rec, (si32)preview, source, ansi::hi(script_body_ptr->second));
// }
//}
- bindings.push_back({ .chord = std::move(on_rec), .sources = std::move(sources), .script_ptr = script_body_ptr });
+ bindings.push_back({ .chord = std::move(on_rec), .sources = std::move(sources), .script_ptr = script_body_ptr, .prerun_ptr = prerun_body_ptr });
}
}
return bindings;
diff --git a/src/vtm.xml b/src/vtm.xml
index 94609294ce..88267e7ed4 100644
--- a/src/vtm.xml
+++ b/src/vtm.xml
@@ -376,7 +376,7 @@ R"==(
-
+
From 318db5d039634430f8848b0761c95e37eefb7b58 Mon Sep 17 00:00:00 2001
From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com>
Date: Sun, 19 Oct 2025 02:33:44 +0500
Subject: [PATCH 2/2] v2025.10.18
---
src/netxs/desktopio/application.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp
index 7665dd7c16..6789cc9d35 100644
--- a/src/netxs/desktopio/application.hpp
+++ b/src/netxs/desktopio/application.hpp
@@ -22,7 +22,7 @@ namespace netxs::app
namespace netxs::app::shared
{
- static const auto version = "v2025.10.17";
+ static const auto version = "v2025.10.18";
static const auto repository = "https://github.com/directvt/vtm";
static const auto usr_config = "~/.config/vtm/settings.xml"s;
static const auto sys_config = "/etc/vtm/settings.xml"s;