Thank you Ihor for finding such an important bug.

I've tried to pinpoint it.
I think it happens only when: first heading (row) is the first line of the buffer.
To reproduce it:
* a
* b
* c

C-u C-c C-x C-c => runs `org-columns' with global argument.
Using a keyboard. Press M-<down>, M-<down>, M-<up>.
Heading 'a' will disappear.  

I've tried to create a test based on that behaviour, but can't reproduce this bug in test env.
Also I can't reproduce this when I'm invoking the commands directly from M-x.
As I understand it something with overlay. Which try to jump before the first line of the buffer.
And that makes some kind of overflow?
I will try to simplify the example and create a simple overlay without org-columns.
If anyone has some ideas how to debug it I will be grateful for the hints.


On Sun, Apr 9, 2023 at 11:13 AM Ihor Radchenko <yantar92@posteo.net> wrote:
Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> Thank you Ihor for the code review.
> Now please help me find everything that can be improved in this patch.

I just tried to use the patch using the following test case:

1. Create a new Org file containing

* A
* B
* C
** C1
* D

2. C-u C-c C-x C-c
3. M-<
4. M-<down> M-<up> M-<down> M-<up> M-<down> M-<up> M-<down> M-<up> C-c C-c
5. Observe text disappearing and columns being unhighlighted. At the
   end, the buffer is left with

* B

>> Finally, I see no records about you copyright assignment status.
>> Please take a look at
>> https://orgmode.org/worg/org-contribute.html#copyright
>>
>
>  Yes, it's my first time. I sent an email to assign@gnu.org, yesterday.

Note that they should reply within 5 working days.

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>