Page 6 of 9
New productivity upload: X16 Edit - a text editor
Posted: Mon Dec 13, 2021 5:05 pm
by desertfish
I can't get it to work, no matter what I try the cursor always jumps to the first column when I press enter. Tried ^A to turn auto indent on /off, no difference. I'm quite confused and feel stupid ? There's no visible indicator to tell me if autoindent should be enabled or not so I just assume it should be. This is what I configured in the config registers as well when jumping into the editor from the assembler. I type: <TAB>test<ENTER> and expect the cursor to be put under the t of test, but it stays in column 1 instead.
New productivity upload: X16 Edit - a text editor
Posted: Mon Dec 13, 2021 5:43 pm
by Stefan
Sounds intriguing...
After pressing Ctrl+A to activate auto indent, there should be a message in the status bar at the bottom of the screen saying "AUTO INDENT ON". And when disabling you should see "AUTO INDENT OFF" in the status bar. You may see the status bar message at the start of the video I attached to my last post.
On Windows and Linux, some Ctrl+key sequences are used by the emulator. One example is Ctrl+R, that resets the emulator instead of its intended action, to open a file. Maybe Ctrl+A is masked in the same way on Windows and Linux.
If that is the case, auto indent may alternatively be enabled by first pressing and releasing ESC. In the status bar you should see "ENTER COMMAND OR PRESS ESC TO ABORT". If you now press A, it should enable auto indent.
However, that doesn't explain why you did not get auto indent when using the new load-file-with-options entry. Need to see your code to understand that (hopefully).
New productivity upload: X16 Edit - a text editor
Posted: Mon Dec 13, 2021 10:06 pm
by desertfish
Thanks Stefan, the ^A is eaten by the emulator somehow - esc+A did the trick!
Also the editor not launching with auto-indenting enabled was a typo on my part where I set the wrong bit in the config register, sorry ? Works beautifully now.
I think I'll release a new version of the assembler with the changes so far.
New productivity upload: X16 Edit - a text editor
Posted: Tue Dec 14, 2021 5:59 am
by Stefan
@desertfish, glad you got it working, even if the "eaten" keys are a bit annoying.
I have been thinking about supporting another control key than Ctrl.
At least on MacOS, Alt works like the Commodore key. In Petscii upper case/graphics mode, pressing Alt+A results in a "top left corner" kind of char. Pressing Alt+Shift+A returns a heart. Is that the same on Windows/Linux? Alt seems not to be a good candidate.
Maybe the Win key is not used for anything else by the X16 Kernal or the emulator, and could be used as an alternative control key.
New productivity upload: X16 Edit - a text editor
Posted: Tue Dec 14, 2021 5:41 pm
by desertfish
Yes alt is the commodore key. The windows/meta key is usually intercepted by my desktop environment on Linux.
New productivity upload: X16 Edit - a text editor
Posted: Tue Dec 14, 2021 7:33 pm
by Stefan
OK. I guess there is no easy solution. Hopefully it works as intended on the real hardware, but remains to be seen.
New productivity upload: X16 Edit - a text editor
Posted: Tue Dec 14, 2021 8:11 pm
by desertfish
As an aside: box16 can be launched with -nobinds option, that removes most emulator keyboard shortcut bindings such as ^R.
New productivity upload: X16 Edit - a text editor
Posted: Sun Jan 23, 2022 6:02 pm
by Stefan
Since version 0.4.0, published in September 2021, you haven't been able to run X16 Edit in the last stable release of the emulator and Kernal (R38).
In order to run X16 Edit, you have had to compile the emulator and Kernal from the Github master branch, what might become R39. I understand that setting up the build environment and compiling is not for everyone. Therefore I tried to modify the last version of X16 Edit (0.4.2) to make it run in R38. The result of this was published today as version 0.4.2-R38.
The changes were fairly simple to do, but I haven't tested it thoroughly.
One difference is the addresses used for bank switching. But this is just two definitions in the source code, one for RAM bank and one for ROM bank select.
The other significant difference is keyboard functionality. Since 0.4.0, X16 Edit uses a custom PS/2 scan code handler in order to read modifier key status and some extra keys such as DELETE, END, PgUp, PgDn, and the numerical keypad. This is simply not possible to do in R38. The modifier keys can be read by other means in R38, but there is no way that I know of to support keys ignored by the Kernal in R38.
A benefit of supporting R38 is that the Try It Now button now may run 0.4.2-R38.
New productivity upload: X16 Edit - a text editor
Posted: Mon Jan 24, 2022 4:27 pm
by mobluse
Great that the try it now button works! I believe it is possible to inlude example files that work with the try it now button.
You use Ctrl+S for replace, but in ordinary Nano that is save without prompt, and that is one of my favourite commands since it is the same in many editors, e.g. Notepad. In Nano replace is a subcommand to Ctrl+W (search): Ctrl+R.
New productivity upload: X16 Edit - a text editor
Posted: Mon Jan 24, 2022 5:48 pm
by Stefan
Thanks.
It would be interesting to replicate Nano keyboard shortcuts more closely.
When I've looked into this question before, I've been put off by Nano's use of two modifier keys, and the fact that the Alt key is already used by the X16 for inserting graphical characters. Nano alternatively lets you single or double tap the ESC key instead, but it feels like a fallback.
I didn't know that Ctrl+S could be used for saving. Traditionally Nano returned the error message "XOFF ignored, mumble, mumble" when you pressed Ctrl+S, and it still does on my computer running Nano 2.0.6.
Replace is, at least in Nano 2.0.6, also available by Meta-R. Using subcommands adds a little complexity to the UI, but it is certainly doable. There is already support for context menus in X16 Edit.
X16 Edit has some commands that is not needed/available in Nano:
Ctrl+D to change device number
Ctrl+E to change character set
Ctrl+I to invoke DOS commands
Ctrl+T to change text color, and Ctrl+B to change background color
Ctrl+M to show memory usage
If you would like to make a table of shortcuts, I would be more than happy to look into that.