If you’ve used other code editors such as Visual Studio Code or BBEdit you may have run across a feature that lets you easily move a line or a selection up or down in the editor. Similarly, you may have used the command to duplicate entire lines (or a selection).
Starting with Xojo 2023r1 you can now do this in the Xojo Code Editor.
To swap lines, put the cursor on a line and press Option+Up Arrow (Mac) or Alt+Up Arrow (Win/Linux) to move the line up in the code. Press Down arrow to move down. Here’s a quick view of how this looks:
It also works with a selection:
To duplicate a line, put the cursor on the line and press Option+Shift+Down Arrow (use Alt instead of Option on Windows/Linux):
This also works with a selection:
I hope these new commands can make your time in the Xojo Code Editor more productive!
Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at Goto 10 and on Mastodon @lefebvre@hachyderm.io.