-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KEY hotkey command setting, calling, and clearing. #121
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Steve Sims <[email protected]>
@@ -193,6 +194,14 @@ UINT8 fat_EOF(FIL * fp); | |||
#define HELP_TYPE "Display the contents of a file on the screen\r\n" | |||
#define HELP_TYPE_ARGS "<filename>" | |||
|
|||
#define HELP_KEY "Store a command in one of 12 hotkey slots assigned to F1-F12\r\n\r\n" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super-tiny gotcha in this file is that the help
command response contents (help help
) currently does not compose the list of commands, so you should explicitly add in KEY
into HELP_HELP
This looks good but at the moment can not expand keys definitions within a BASIC line. At least according to my BBC Master. |
Another behavior different from BBC Micro. |
You're putting the command in quotes so that's what it's sending. |
I am just comparing it with BBC Micro and noting the differences. |
Sure, and you're right. It wouldn't be a hardship to essentially ignore any leading and trailing quotes in the command string so both syntaxes work, |
Here is my take: // KEY command
} void removeFirstAndLastQuotes(char *str) {
} |
IMHO for matters concerning the line input system, it's not really sensible to compare the Agon to the BBC Micro. The two systems take very different approaches to line input. Each has their plusses and minuses. personally my preference would be to emulate how the Beeb works, since that's my history (I grew up with Acorn machines) - but practically speaking to do so would be significantly harder to implement given how the line input system currently works. perhaps at some point in the future we will revisit how the line input system in MOS works. there may be some advantages in doing so for other areas of functionality (for instance allowing therefore until then, I believe that the approach taken in this PR is a sensible compromise, given the capabilities of the current line input system. it also has the advantage over the Beeb's version of being able to wrap the existing input on a line |
I do agree with you that the current Agon implementation is good enough. However, when possible, the differences between Agon and BBC BASIC should be documented. AS many users are familiar with BBC Basic , it would save them valuable time. |
Ok, I don't know what the comment about code review is regarding - that's the point of a pull request, no? I agree on documentation, regardless of whether it's just good practice or because we want to document the differences with Acorn systems. @leventp I really like most of your implementation and hadn't actually clocked that we had a globally exposed mos_strtok pointer, that's much neater. That said, I don't think we need the ChatGPT removeFirstAndLastQuotes cruft - surely we can just test |
@HeathenUK About code reviews , I meant it should be a standard/formal process (with at least two people involved) for each PR. I do really appreciate your work on this implementation PR as I was the one who created the corresponding issue/enhancement. The Agon community is getting stronger and larger so looking forward to future enhancements. |
Nothing wrong with using CGPT for ideation, but it tends toward modularising functions like this which ZDS doesn't do the best optmising of. If we can simple scan and then alter the original string I reckon we should do that. I'll have a look later at combining the approaches. |
Sounds good. Just noticed that the following entry treated as '*KEY' without any command string. Guess mos function for conversion does not distinguish the errors between NULL and an ASCII non-numeric character. Also wrote a simple BASIC program for testing different conditions as below. Might be useful. 10 REM *KEY test cases |
…bytes and simplifies), strip quotes if both leading and following are found.)
Ok, this new version is the best of both worlds, I think. |
Looking good. I made a few small changes (in mos_editor.c) as follows that work for me. Wanted to expand keys in the BASIC lines at the expense of Newline. BBC BASIC uses control characters for newline anyway. if (wildcardPos == NULL) { //No wildcard in the hotkey string
|
This adds a KEY command that permits the user to assign a string to any of the F1-F12 keys. The string can optionally include a %s token and if it does the resulting command will include in this position whatever was already on the editor line (for example
load %s
(for MOS) orLOAD "%S"
(for BASIC) would allow you to quickly load a file (particularly if coupled with tab completion in PR 120.Requires a 256 byte buffer that holds an untokenized command string.