Remove bogus assertions preventing mouse clicks in insert mode

Recent changes for selection-undo added an assertion that triggers
when a mouse-drag overlaps with an insert mode, because both events
record selection history.  However this is actually fine.  The one
that finishes last concludes the selection edition, while the other
one will be a nop.

The test could be simpler (i.e. not require sleeps) but I figured it
doesn't hurt add this since we don't have any comparable tests.
This commit is contained in:
Johannes Altmanninger 2022-12-03 19:00:46 +01:00
parent 938be7a7b0
commit 35f23d6fad
6 changed files with 14 additions and 3 deletions

View File

@ -117,7 +117,6 @@ public:
bool is_editing() const { return m_edition_level!= 0; } bool is_editing() const { return m_edition_level!= 0; }
void disable_undo_handling() { m_edition_level = -1; } void disable_undo_handling() { m_edition_level = -1; }
bool is_editing_selection() const { return m_selection_history.in_edition(); }
NestedBool& hooks_disabled() { return m_hooks_disabled; } NestedBool& hooks_disabled() { return m_hooks_disabled; }
const NestedBool& hooks_disabled() const { return m_hooks_disabled; } const NestedBool& hooks_disabled() const { return m_hooks_disabled; }

View File

@ -100,7 +100,6 @@ struct MouseHandler
switch (key.mouse_button()) switch (key.mouse_button())
{ {
case Key::MouseButton::Right: { case Key::MouseButton::Right: {
kak_assert(not context.is_editing_selection());
m_dragging.reset(); m_dragging.reset();
cursor = context.window().buffer_coord(key.coord()); cursor = context.window().buffer_coord(key.coord());
ScopedSelectionEdition selection_edition{context}; ScopedSelectionEdition selection_edition{context};
@ -114,7 +113,6 @@ struct MouseHandler
} }
case Key::MouseButton::Left: { case Key::MouseButton::Left: {
kak_assert(not context.is_editing_selection());
m_dragging.reset(new ScopedSelectionEdition{context}); m_dragging.reset(new ScopedSelectionEdition{context});
m_anchor = context.window().buffer_coord(key.coord()); m_anchor = context.window().buffer_coord(key.coord());
if (not (key.modifiers & Key::Modifiers::Control)) if (not (key.modifiers & Key::Modifiers::Control))

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
123

View File

@ -0,0 +1 @@
a1b2c3

View File

@ -0,0 +1,11 @@
ui_out -ignore 4
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "i" ] }'
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "a" ] }'
sleep .1
ui_in '{ "jsonrpc": "2.0", "method": "mouse_press", "params": [ "left", 0, 2 ] }'
sleep .1
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "b" ] }'
sleep .1
ui_in '{ "jsonrpc": "2.0", "method": "mouse_release", "params": [ "left", 0, 4 ] }'
sleep .1
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "c<esc>" ] }'