aboutsummaryrefslogtreecommitdiff
path: root/src/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor.rs')
-rw-r--r--src/editor.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/editor.rs b/src/editor.rs
index c756990..f8ee4bc 100644
--- a/src/editor.rs
+++ b/src/editor.rs
@@ -37,7 +37,17 @@ impl Editor {
// Handle keybindings for tool change
for (i, tool) in self.tools.iter().enumerate() {
if tool.activation_key().is_pressed(rl) {
+ // Don't do anything if the tool does not change.
+ if i == self.active {
+ break;
+ }
+
+ /* Deactivate the current tool and activate the tool, of which the keybinding has
+ * been pressed.
+ */
+ self.tools[self.active].deactivate();
self.active = i;
+ self.tools[self.active].activate();
break;
}
}