the union of a collection of sets is the set of all elements in the collection.
Yes, this definition is correct. And selection seems a kind of set contains characters as its elements. So I expected both <a-z>a and <a-z>u to “add” registered selections to current ones. However, you know, this exactly is what <a-z>a is doing, not <a-z>u is.
What “u: union” is doing is… for my poor English, I can’t find proper words… a sort of “connect each selections.” Hmm… in my intuition, “union” never add elements that are outside sets…
After that, I found these conventions came from vis’ pairwise combining operator. So now I don’t think we should rename these operators, but do think adding some more explanations to infobox helps newcomers.
Here’s what currently happen with this union operator:
Example: the 2nd line of a buffer is selected and saved into register with Z. Then you go on the 5th line, select it and decide to do a union with <a-z>u. The result is one big selection starting on line 2 and finishing line on 5. Whereas an append operation <a-z>a would result in only the line 2 and the line 5 selected.
So as you said the definition is maybe not strictly mathematically correct.
The behaviors I described above may be quite hard to describe succinctly in a small infobox.
(I proposed a little improvement this week: https://github.com/mawww/kakoune/issues/3089 to a related matter)
Maybe we need to start a “combine operators” page on the wiki with visual example.
In fact, your issue (#3089) recalled me a kind of awkwardness of “union” operator and led to create this topic
Well, as you said, the infobox is too small for clear explanation, so now I also think it’s better to improve the wiki. (But I’m too lazy to make visual example of these…)
Also, I welcome “difference” (or “subtract”) operator! To be honest, in almost all interactive use-case, I chose only “append lists” other than pairwise operators because they are too complicated.
However, I think these are essential for “text manipulation language.” And I guess difference operator may be useful when to split selections manually.