CREATE TABLE `test` (
`a` INT(11) NULL DEFAULT NULL,
`b` INT(11) NULL DEFAULT NULL,
`c` INT(11) NULL DEFAULT NULL,
INDEX `idx` (`a`, `b`, `c`)
);
Crash when item is dropped.
If I drop item 'a' just on the item 'c' when there is no line under the 'c' item -- no crash.
If I drop 'a' item below 'b' when the line is displayed -- no crash, however the item 'a' would be at the very bottom, but not between item 'b' and item 'c' where it was dropped.
If I drop the item 'a' above item 'b' when the line is displayed -- no crash, however it would appeared below item 'b'.
Looks like drop index is not calculated correctly in this case.
I hope not to crash would be better behaviour :)
Anyone to confirm?
I have the same behaviour on two different PCs.
Confirmed with 5453.
The behavior of index tab is a bit confuses. Sometimes it replaces with target position, another times it allows move to above or below target. Very random. The second case will crash after move below target.
Report attached: issue-385.txt
Looks like this line is causing the issue (table_editor.pas):
if Mode = dmBelow then Inc(ColPos);
The easiest fix would be to add index range check:
if Mode = dmBelow then Inc(ColPos);
+if ColPos > Node.Parent.ChildCount then ColPos := Node.Parent.ChildCount;
However, I think the code should also check if the source idx is higher than target idx or not as currently the logic is inconsistent. For example:
Thanks for that. It is not crashing any longer, but when you drag the 'c' in example above and drop it between 'a' and 'b' it actually dropping before 'a'.
Yes, can confirm that.
Additionally look that: https://youtu.be/-st2vkMZM6U
The main issue was I did not take into account whether the dropped column comes from above or from below. This should now be fixed, along with that missing repaint issue.
It works fine when I'm trying to re-arrange columns in existing index.
However, when creating a new index and dropping columns from column table (that is below) it still does not work correctly.
For the table created with script above:
Sorry for that. I'm just a messenger.
Should I create a new ticket or this one will be re-opened (as it was only partially fixed)?
Thanks.
Ah, sorry, I already read it, but forgot about it somehow. No new ticket please, I am reopening this one.
Next build should also fix that wrong position when dropping a column from the columns list. Also, dragging a column above or below an index is blocked, as that makes no sense for a column. Only dragging it onto an index is allowed. Dragging between existing columns of an index is of course allowed also.
All OK now. Many thanks.