diff --git a/README.rst b/README.rst
index 35e44e5c1..7e8678c9f 100644
--- a/README.rst
+++ b/README.rst
@@ -1013,7 +1013,8 @@ Subcommands that persist until disabled or DF quit:
in advmode. The issue is that the screen tries to force you to select
the contents separately from the container. This forcefully skips child
reagents.
-
+:fast-trade: Makes Shift-Enter in the Move Goods to Depot and Trade screens select
+ the current item (fully, in case of a stack), and scroll down one line.
Mode switch and reclaim
=======================
diff --git a/Readme.html b/Readme.html
index 3610ecd80..6155b72ce 100644
--- a/Readme.html
+++ b/Readme.html
@@ -1753,6 +1753,9 @@ in advmode. The issue is that the screen tries to force you to select
the contents separately from the container. This forcefully skips child
reagents.
+
fast-trade: | Makes Shift-Enter in the Move Goods to Depot and Trade screens select
+the current item (fully, in case of a stack), and scroll down one line. |
+
diff --git a/dfhack.init-example b/dfhack.init-example
index 0bf344609..8a3ec8f29 100644
--- a/dfhack.init-example
+++ b/dfhack.init-example
@@ -45,6 +45,7 @@ keybinding add Shift-R "job-material RHYOLITE"
keybinding add Shift-I "job-material CINNABAR"
keybinding add Shift-B "job-material COBALTITE"
keybinding add Shift-O "job-material OBSIDIAN"
+keybinding add Shift-T "job-material ORTHOCLASE"
keybinding add Shift-G "job-material GLASS_GREEN"
# browse linked mechanisms
@@ -90,3 +91,7 @@ tweak fix-dimensions
# make reactions requiring containers usable in advmode - the issue is
# that the screen asks for those reagents to be selected directly
tweak advmode-contained
+
+# support Shift-Enter in Trade and Move Goods to Depot screens for faster
+# selection; it selects the current item or stack and scrolls down one line
+tweak fast-trade
diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp
index 0b0b99d48..f3c6664a1 100644
--- a/plugins/manipulator.cpp
+++ b/plugins/manipulator.cpp
@@ -523,6 +523,7 @@ void viewscreen_unitlaborsst::feed(set *events)
{
events->insert(interface_key::LEAVESCREEN);
parent->feed(events);
+ events->clear();
}
return;
}
diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp
index fb286e0d7..6d0591d13 100644
--- a/plugins/tweak.cpp
+++ b/plugins/tweak.cpp
@@ -43,6 +43,8 @@
#include "df/reaction.h"
#include "df/reaction_reagent_itemst.h"
#include "df/reaction_reagent_flags.h"
+#include "df/viewscreen_layer_assigntradest.h"
+#include "df/viewscreen_tradegoodsst.h"
#include
@@ -109,6 +111,9 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector *input))
+ {
+ if (layer_objects[1]->active && input->count(interface_key::SELECT_ALL))
+ {
+ set tmp; tmp.insert(interface_key::SELECT);
+ INTERPOSE_NEXT(feed)(&tmp);
+ tmp.clear(); tmp.insert(interface_key::STANDARDSCROLL_DOWN);
+ INTERPOSE_NEXT(feed)(&tmp);
+ }
+ else
+ INTERPOSE_NEXT(feed)(input);
+ }
+};
+
+IMPLEMENT_VMETHOD_INTERPOSE(fast_trade_assign_hook, feed);
+
+struct fast_trade_select_hook : df::viewscreen_tradegoodsst {
+ typedef df::viewscreen_tradegoodsst interpose_base;
+
+ DEFINE_VMETHOD_INTERPOSE(void, feed, (set *input))
+ {
+ if (!(is_unloading || !has_traders || in_edit_count)
+ && input->count(interface_key::SELECT_ALL))
+ {
+ set tmp; tmp.insert(interface_key::SELECT);
+ INTERPOSE_NEXT(feed)(&tmp);
+ if (in_edit_count)
+ INTERPOSE_NEXT(feed)(&tmp);
+ tmp.clear(); tmp.insert(interface_key::STANDARDSCROLL_DOWN);
+ INTERPOSE_NEXT(feed)(&tmp);
+ }
+ else
+ INTERPOSE_NEXT(feed)(input);
+ }
+};
+
+IMPLEMENT_VMETHOD_INTERPOSE(fast_trade_select_hook, feed);
+
static void enable_hook(color_ostream &out, VMethodInterposeLinkBase &hook, vector ¶meters)
{
if (vector_get(parameters, 1) == "disable")
@@ -653,6 +699,11 @@ static command_result tweak(color_ostream &out, vector ¶meters)
{
enable_hook(out, INTERPOSE_HOOK(advmode_contained_hook, feed), parameters);
}
+ else if (cmd == "fast-trade")
+ {
+ enable_hook(out, INTERPOSE_HOOK(fast_trade_assign_hook, feed), parameters);
+ enable_hook(out, INTERPOSE_HOOK(fast_trade_select_hook, feed), parameters);
+ }
else
return CR_WRONG_USAGE;