From 40751c033d5482d5dd56cd83f2f4e130dbb102f7 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 26 Mar 2025 09:09:16 +1100 Subject: Make sure captures are taken into account when comparing selections sel1 == sel2 was using BasicSelection::operator==, ignoring captures, which led to selection history deciding that selection did not change in some cases where only the captures had been updated and for the new selection not to be properly applied, leading to missing capture. --- src/selection.hh | 2 ++ test/regression/5298-missing-capture-register/cmd | 1 + test/regression/5298-missing-capture-register/in | 1 + test/regression/5298-missing-capture-register/kak_reg_0 | 1 + 4 files changed, 5 insertions(+) create mode 100644 test/regression/5298-missing-capture-register/cmd create mode 100644 test/regression/5298-missing-capture-register/in create mode 100644 test/regression/5298-missing-capture-register/kak_reg_0 diff --git a/src/selection.hh b/src/selection.hh index ede4fa7b..6b07e9f8 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -67,6 +67,8 @@ struct Selection : BasicSelection CaptureList& captures() { return m_captures; } const CaptureList& captures() const { return m_captures; } + friend bool operator==(const Selection&, const Selection&) = default; + private: CaptureList m_captures; }; diff --git a/test/regression/5298-missing-capture-register/cmd b/test/regression/5298-missing-capture-register/cmd new file mode 100644 index 00000000..803d9000 --- /dev/null +++ b/test/regression/5298-missing-capture-register/cmd @@ -0,0 +1 @@ +s(.*) diff --git a/test/regression/5298-missing-capture-register/in b/test/regression/5298-missing-capture-register/in new file mode 100644 index 00000000..c2267c2e --- /dev/null +++ b/test/regression/5298-missing-capture-register/in @@ -0,0 +1 @@ +%(foo) diff --git a/test/regression/5298-missing-capture-register/kak_reg_0 b/test/regression/5298-missing-capture-register/kak_reg_0 new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/test/regression/5298-missing-capture-register/kak_reg_0 @@ -0,0 +1 @@ +foo -- cgit v1.2.3