Ctrl+Up Arrow in Calc with selection

As per the documentation, Ctrl + Up Arrow “Moves the cursor to the top edge of the current data range. If the row above the cell that contains the cursor is empty, the cursor moves up to the next row that contains data.” In other words, if I have data in D10:D24 and I click Ctrl+Up Arrow when the cursor is in D15, it moves into D10. This matches the behavior of Excel.

However, if I have an active selection, it no longer works this way. If I start in D15, select D15:D19 with arrow keys, and then hit Ctrl+Up Arrow, the cursor ends up in D6 (???)

If I want to move the entire D15:D24 region into the next column, aligned with the start of the current column (into E10:E19), I’d like to be able to go to D15, do Ctrl+Shift+Down Arrow (select everything up to D24), Ctrl+X (cut), Ctrl+Up Arrow (move to D10), Right (move to E10), Ctrl+V (paste). In Excel, that’ s exactly what happens. In LibreOffice Calc, it fails because Ctrl+Up Arrow puts me into D6 instead of D10.

Furthermore, the outcome depends on whether I am moving or copying. If I repeat the sequence above, but with Ctrl-C (copy) instead of Ctrl-X, the subsequent Ctrl+Up Arrow moves me to D1.

This was tested with LibreOffice included in Ubuntu 18.04 (version 6.0.3.2).

Is this a bug or is there a valid reason for this behavior?

EDIT: I see essentially the same behavior with Ctrl + Left Arrow.

Suppose I have a column of labels in K10:K19 and a block of data in P10:T19, separated by blank columns. I would like to move the data next to the labels. I start in P10, press Ctrl+* to select the data range (it selects P10:T19), Ctrl+X, Ctrl+Left Arrow. That should put me in K10, and then I’d do Right Arrow, Ctrl+V. Instead Ctrl+Left Arrow sends the cursor somewhere to the left of K10, the exact location depends on the number of columns in the data block. If I do Ctrl+*, Ctrl+C, Ctrl+Left Arrow, it ends up to the right of K10.

More generally, LibreOffice Calc seems to do the following:

  1. Start in the rightmost cell inside the selection (in this example, T10)
  2. Execute the Ctrl+LeftArrow algorithm to locate an edge (in this example, since I did Ctrl+X, everything from L10 to T10 is blank, so it travels to K10)
  3. Move additional N-1 columns to the left, where N is the number of columns inside the selection (in this example, we have 5 columns and it ends up in G10)

Likewise, if I replace Ctrl+X with Ctrl+C, step 2 sends the cursor into P10, and step 3 sends the cursor into L10.

I don’t see the reasoning behind steps 1 and 3.

I think it is this know bug tdf#47818, EDITING: extending selection after pasting selects from top left

I don’t think it’s #47818. I’ve seen #47818 a number of times and it is quite annoying, but distinct from this one.