red
red copied to clipboard
[View] `swap` is ignored by window pane (and surely many other actions)
root issue: https://github.com/red/REP/issues/92
Describe the bug
I'm swapping pane contents but it's not visible so one may accidentally drive thru red light:
To reproduce
repeat i 2 [
append w: [] view/no-wait/options compose [
base (pick [green red] i) on-down [
? w/1/pane/1/color
swap w/1/pane w/2/pane
? w/1/pane/1/color
]
] [offset: as-pair i * 100 + 400 300]
]
do-events
click on the bases
Expected behavior
visible color change:
Platform version
-----------RED & PLATFORM VERSION-----------
RED: [ branch: "master" tag: #v0.6.4 ahead: 4667 date: 9-Apr-2023/3:24:34 commit: #d36108eeffeafbf14839b5a9cadc9a0acd87f34a ]
PLATFORM: [ name: "Windows 10" OS: 'Windows arch: 'x86-64 version: 10.0.0 build: 19044 ]
--------------------------------------------
@hiiamboris For sake of curiosity, did you ever use the swap
action?
It seems to me that the use-cases on series are extremely rare... so much so that I wonder why it got promoted to an action in Rebol...
If we decide not to get rid of it, it should at least be extended to work on pair!
and point2D!
, so at it least I could have a use for it (still rare though).
that I wonder why it got promoted to an action in Rebol...
Always wondered about that too.
IIRC this issue came from a real use case in scrollpanel. I also found another use of it in some old code, but that's it, two uses.
I have a better use for it myself: given two words/paths swap their values: swap 'obj/x 'obj/y
, so I override it in Spaces. Still rare use but more common. move
is also very rare, for an action.
For pair!
and point2D!
we have reverse
.
Agreed on both swap
and move
.
I didn't know their existence and working. They seem suitable to be used when moving lange blocks of records in flat databases. I have tested the /part
attributes and it moves recordsize x records
blocks of data very quickly. If it doesn't cost too much, please leave there move
and swap
as actions.
EDIT: A particular use comes into my mind. When you have a gui with 2 list-views, move
can take all the selected data elements from one list to another. Swap
, on its side, could swap an entire list from source to destination and viceversa. I think we still need some real world use scenery apreciate them.
This is absurd. Instead of swapping items around you can just exchange data blocks. For move/part
case change
won't be slower, since in case of intersection it has to allocate new buffer anyway, or worse - shift the original series in place.
This is absurd. Instead of swapping items around you can just exchange data blocks. For
move/part
casechange
won't be slower, since in case of intersection it has to allocate new buffer anyway, or worse - shift the original series in place.
You can swap until the list is not referenced by multiple words/blocks; in this case you must find each structure. Ok, that's doable. But in case you have anonymous containers pointing to the lists, you can't swap just the data blocks.