PR# 16478 ARRAYED_CIRCULAR.remove moves cursor to the wrong place when deleting the last item

Problem Report Summary
Submitter: camillo
Category: EiffelBase
Priority: Medium
Date: 2009/11/21
Class: Bug
Severity: Serious
Number: 16478
Release: 6.4
Confidential: No
Status: Open
Responsible:
Environment: EiffelStudio 6.4 GPL
Synopsis: ARRAYED_CIRCULAR.remove moves cursor to the wrong place when deleting the last item

Description
When calling "remove" on an ARRAYED_CIRCULAR, the cursor is supposed to move to the item on the right on the one that is deleted (cyclically). Therefore, when deleting the last item, the cursor should move to the first. But instead it moves to the second-to-last (which becomes the last after removal), ie it moves left instead of right. It does move right for all other items.
To Reproduce
	test_arrayed_circular
			-- This fails in ES 6.4
		local
			c: ARRAYED_CIRCULAR[CHARACTER]
			i: INTEGER
		do
			create c.make (5)
			c.fill ("12345")
			c.go_i_th (5)
			c.remove
			-- Remove docs say:
			-- Remove item at cursor position.
			-- Move cursor to right neighbor (cyclically).
			-- If removed item was at current starting position,
			-- move starting position to right neighbor.
			assert ("moved_to_right", c.item = '1') -- in fact, it moves to item 4
		end
Problem Report Interactions