History updated incorrectly on Alt+G

Have 3 files: 1.txt, 2.txt, 3.txt.

  1. Open 1.txt via: Ctrl+O, type 1, Enter.
  2. From there, open 2.txt: Ctrl+O, type 2, Enter.
  3. Go back to 1.txt: Alt+G.
  4. Open 3.txt (from 1.txt): Ctrl+O, type 3, Enter.
  5. Go back: Alt+G.

Actual (bug): file 2.txt is opened.

Expected: file 1.txt is opened because the history has been changing like so (first entry in the list = currently opened file):

  1. Empty history
  2. 1.txt
  3. 2.txt, 1.txt
  4. 1.txt, 2.txt ((Alt+G)
  5. 3.txt, 1.txt, 2.txt
  6. Switch (Alt+G): from 3.txt to 1.txt but it switches from 3.txt to 2.txt