fix #38991: cursor jump on up/down if layout changes
Merge pull request #1453 from MarcSabatella/38991-cursor-jump-updown

fix #38991: cursor jump on up/down if layout changes