summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2025-03-26 09:09:16 +1100
committerMaxime Coste <mawww@kakoune.org>2025-03-26 09:09:16 +1100
commit40751c033d5482d5dd56cd83f2f4e130dbb102f7 (patch)
tree4293c42a5c3ebbcbdc8d53224c1703bf43827579
parent04accbb26734fe3f91443ee8567d275a09020f27 (diff)
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.
-rw-r--r--src/selection.hh2
-rw-r--r--test/regression/5298-missing-capture-register/cmd1
-rw-r--r--test/regression/5298-missing-capture-register/in1
-rw-r--r--test/regression/5298-missing-capture-register/kak_reg_01
4 files changed, 5 insertions, 0 deletions
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(.*)<ret>
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