BBC BASIC for SDL 2.0 version 1.21a released

for discussion of bbc basic for windows/sdl, brandy and more
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 1:00 pm
Ctrl+Cmd+Left bongs and prints 128, and Ctrl+Cmd+Right bongs and prints 129 (no matter which of the two Cmd keys I use).
The actual codes are unimportant, what matters is that a keypress event is generated. Knowing that, I can modify BBC BASIC to generate whatever code seems to be most appropriate. Since Cmd+left is equivalent to Home and Cmd+right to End on a PC keyboard, my intention would be that Ctrl+Cmd+left will generate the same code as Ctrl+Home and Ctrl+Cmd+right the same as Ctrl+End.

Would you be kind enough to repeat the test with the Fn key. Do Fn+left, Fn+right, Fn+up and Fn+down generate any codes in BBC BASIC at all?
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote:
Fri Apr 30, 2021 1:48 pm
Would you be kind enough to repeat the test with the Fn key. Do Fn+left, Fn+right, Fn+up and Fn+down generate any codes in BBC BASIC at all?
Yes: 130, 131, 132 and 133 respectively.

Incidentally, I can't seem to get the IDE to run programs that use keyword abbreviations, such as your example: REP.P.GET:U..

The program window just says "Mistake" (or "Mistake at line 10"). What am I doing wrong?

:?:
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 1:59 pm
What am I doing wrong?
You're not doing anything wrong. BBC BASIC for Windows has a configuration option to allow or disallow keyword abbreviations in the editor, but realistically you must always disable them otherwise they clash with the syntax for structure members (if you put R.a meaning 'member a' of 'structure R' it's not at all helpful if the R. is expanded to RETURN!). So when it came to writing SDLIDE I simply decided not to support keyword abbreviations at all.

You can still use abbreviations in immediate mode, because of course that's a function of the interpreter's parser/tokeniser and completely independent of the editor. The possibility of a reference to a structure member being mistaken for a keyword abbreviation still arises, but you're pretty unlikely to be wanting to do that in immediate mode.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
BigEd
Posts: 4046
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

Oops, I do apologise - I had of course downloaded the correct version and then opened a previous download. Even though I'd tried to be careful.

I can confirm lurkio's observations above, including the presence or absence of bongs: 128,129, and 130, 131, 132, 133.
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 1:59 pm
Yes: 130, 131, 132 and 133 respectively.
That leaves me rather confused again (an almost continuous state, I'm afraid). In an earlier reply you wrote "Then there's Cmd+left_arrow, which should move the cursor to the beginning of the current line. And Cmd+right_arrow to move to the end thereof" which I understood to mean that they are equivalent to the Home and End keys on a standard PC keyboard (because that's what those keys generally do).

But Home and End generate codes 130 and 131 in Windows which would make me think that Fn+left and Fn+right are the Mac equivalents, not Cmd+left and Cmd+right! So what are the most common functions of those four keyboard shortcuts on Macs? Two of them are seemingly move to the beginning and end of the current line (which two?) but what do the others do? :?

Edit: This is perhaps relevant.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

Richard Russell wrote:
Fri Apr 30, 2021 2:27 pm
Edit: This is perhaps relevant.
From that linked page: “Well, we only added those keys to keep PC users happy. Let’s really mess with them. We don’t need to make them happy, we’ve got truckloads of brain-washed fanboy to keep our User satisfaction numbers up”. :lol: :roll:
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote:
Fri Apr 30, 2021 2:27 pm
lurkio wrote:
Fri Apr 30, 2021 1:59 pm
Yes: 130, 131, 132 and 133 respectively.
That leaves me rather confused again (an almost continuous state, I'm afraid). In an earlier reply you wrote "Then there's Cmd+left_arrow, which should move the cursor to the beginning of the current line. And Cmd+right_arrow to move to the end thereof" which I understood to mean that they are equivalent to the Home and End keys on a standard PC keyboard (because that's what those keys generally do).

But Home and End generate codes 130 and 131 in Windows which would make me think that Fn+left and Fn+right are the Mac equivalents, not Cmd+left and Cmd+right! So what are the most common functions of those four keyboard shortcuts on Macs? Two of them are seemingly move to the beginning and end of the current line (which two?) but what do the others do? :?
I never use Fn+Left, Fn+Right, Fn+Up or Fn+Down. In TextEdit (the native "built-in" macOs text editor), they don't perform any function: they don't move the cursor, and nor do they bong. In the BBCSDL IDE, they seem to move the cursor to the beginning of the line, to the end of the line, to the beginning of the document, and to the end of the document, respectively. When typed into the BBCSDL BASIC program REP.P.GET:U.. in immediate mode, they print key codes 130, 131, 132 and 133 respectively.

I frequently use Cmd+Left and Cmd+Right to move to the beginning and end of the current line in multiple macOS apps. I less frequently use Cmd+Up and Cmd+Down to move to the beginning and end of a document. When typed into the BBCSDL BASIC program REP.P.GET:U.. in immediate mode, Cmd+Left, Cmd+Right, Cmd+Up and Cmd+Down print the key codes 136, 137, 139 and 138 respectively.

:idea:

EDIT: Ah, and now we have a problem! When typed into the BBCSDL BASIC program REP.P.GET:U.. in immediate mode, Alt+Left, Alt+Right, Alt+Up and Alt+Down also print key codes 136, 137, 139 and 138 respectively! The same as the Cmd+ equivalents! But in "standard" macOS apps, the Cmd+direction keys perform different functions from the Alt+direction keys! (Alt+Left/Right=back/forward one word. Alt+Up/Down=Go to beginning/end of line.) Oh dear...
Last edited by lurkio on Fri Apr 30, 2021 3:17 pm, edited 2 times in total.
User avatar
BigEd
Posts: 4046
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

(I just plugged in a USB keyboard and can confirm that TextEdit doesn't respond to Home, End, PgUp and PgDn either. So, that's a native Apple application, and it doesn't use those keys. But Terminal uses them to scroll... so they are known to at least on native application. But not as synonyms for ctrl-Cmd-Left, etc.)
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

lurkio wrote:
Fri Apr 30, 2021 3:04 pm
EDIT: Ah, and now we have a problem! ...
Or maybe not...
Richard Russell wrote:
Fri Apr 30, 2021 1:48 pm
The actual codes are unimportant, what matters is that a keypress event is generated. Knowing that, I can modify BBC BASIC to generate whatever code seems to be most appropriate.
:?:
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 3:04 pm
I never use Fn+Left, Fn+Right, Fn+Up or Fn+Down. In TextEdit (the native "built-in" macOs text editor), they don't perform any function.
OK, but I think that probably makes TextEdit an 'outlier'. It's pretty clear from the codes they generate that Fn+Left, Fn+Right, Fn+Up and Fn+Down are intended to be direct equivalents of the Home, End, PgUp, and PgDn keys on a standard PC keyboard (and in the case of the first two this is confirmed by Apple themselves here). You would expect a text editor to respond to those, and my SDLIDE editor does.

Where the complication arises appears to be that Macs and PCs define Home and End differently, by default. On PCs Home and End are 'move to the beginning or end of the line' but on Macs they are 'move to the beginning or end of the document' (again that is confirmed here).

So (short of a configuration option, which I really don't like) I'm not going to be able to please everybody, because I want Home and End to work consistently in SDLIDE across all platforms. In practice that means I want them to work as they do in Windows (beginning and end of line) and from the page I linked to it's pretty clear that people who have moved from a PC to a Mac want that too.

So that determines what FN+left and FN+right will (and indeed already) do in SDLIDE: move to the beginning and end of the line. But that leaves some unanswered questions: principally what should Cmd+left and Cmd+right do, and what keyboard shortcuts on a Mac should move to the beginning and end of the document?

For maximum compatibility and minimum irritation one option would be to make Cmd+left and Cmd+right do the same as Fn+left and Fn+right (even though that feels like a wasteful duplication) and Cmd+up and Cmd+down move to the beginning and end of the document.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
lurkio wrote:
Fri Apr 30, 2021 3:04 pm
I never use Fn+Left, Fn+Right, Fn+Up or Fn+Down. In TextEdit (the native "built-in" macOs text editor), they don't perform any function.
OK, but I think that probably makes TextEdit an 'outlier'.
Not really. I'm pretty sure that most "native" Mac apps that allow you to edit text behave in the same way in this respect. Certainly BBEdit does, and that's a very popular code editor on the Mac (if not the most popular).

Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
So (short of a configuration option, which I really don't like) I'm not going to be able to please everybody, because I want Home and End to work consistently in SDLIDE across all platforms. In practice that means I want them to work as they do in Windows (beginning and end of line) and from the page I linked to it's pretty clear that people who have moved from a PC to a Mac want that too.
Fair enough.

Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
For maximum compatibility and minimum irritation one option would be to make Cmd+left and Cmd+right do the same as Fn+left and Fn+right
I think that's the right thing to do. Cmd+Left and Cmd+Right are very commonly used to move the cursor to the beginning and the end of the current line -- certainly by me!

Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
Cmd+up and Cmd+down move to the beginning and end of the document.
Seems fine.

Also, hopefully Alt+Left and Alt+Right can be made to move the cursor back and forward by one word in the BBCSDL IDE?

:idea:
Last edited by lurkio on Fri Apr 30, 2021 4:04 pm, edited 1 time in total.
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 3:47 pm
Not really. I'm pretty sure that most "native" Mac apps that allow you to edit text behave in the same way in this respect.
I still think that anything that calls itself a 'text editor' should respond to keys labelled Home and End (e.g. when using a standard PC keyboard with a Mac Mini) and Apple themselves acknowledge that Fn+left and Fn+right are the direct equivalents of those on a Mac keyboard. Perhaps some of the apps you refer to are so old that they existed before the first Mac Mini, and therefore never encountered those keys.
Also, hopefully Alt+Left and Alt+Right can be made to move the cursor back and forward by one word in the BBCSDL IDE?
As I mentioned before, that's an entirely separate issue. I can safely modify how the Cmd+ key combinations work on a Mac because you can't use the equivalent ('Windows') key that way on a PC anyway, so there is no compatibility issue. However I cannot modify how the Alt+ key combinations behave because that would affect every platform and introduce an incompatibility.

So making Alt+left and Alt+right do word-left and word-right is something that will need to be achieved within the confines of SDLIDE (indeed I have already made that change in my copy) rather than in the 'interpreter'.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote:
Fri Apr 30, 2021 4:03 pm
So making Alt+left and Alt+right do word-left and word-right is something that will need to be achieved within the confines of SDLIDE (indeed I have already made that change in my copy) rather than in the 'interpreter'.
Great! I look forward to trying it out.

:idea:
User avatar
lurkio
Posts: 3527
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

lurkio wrote:
Fri Apr 30, 2021 3:04 pm
I never use Fn+Left, Fn+Right, Fn+Up or Fn+Down. In TextEdit (the native "built-in" macOs text editor), they don't perform any function: they don't move the cursor, and nor do they bong.
Correction! In both TextEdit and BBEdit, Fn+Up performs a Page Up (but doesn't move the cursor), Fn+Down performs a Page Down (but doesn't move the cursor), Fn+Left moves the scrollbar to the beginning of the document (but doesn't move the cursor), and Fn+Right moves the scrollbar to the end of the document (but doesn't move the cursor).

Nevertheless, I still agree with you when you say this:
Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
So that determines what FN+left and FN+right will (and indeed already) do in SDLIDE: move to the beginning and end of the line.
:idea:
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

lurkio wrote:
Fri Apr 30, 2021 4:33 pm
Correction! In both TextEdit and BBEdit, Fn+Up performs a Page Up (but doesn't move the cursor), Fn+Down performs a Page Down (but doesn't move the cursor), Fn+Left moves the scrollbar to the beginning of the document, and Fn+Right moves the scrollbar to the end of the document.
That's much more what I expected, and is consistent with Apple's own documentation (and that Home and End by default have different actions in Windows and MacOS). So there may be a few BBC BASIC users who are irritated that those two keys (or equivalently Fn+left and Fn+right) behave differently from what they are used to on a Mac, but cross-platform applications have to confront that sort of issue, and there are evidently plenty of users who have switched from a PC to a Mac who prefer them to work the Windows way anyway.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

Richard Russell wrote:
Fri Apr 30, 2021 3:38 pm
For maximum compatibility and minimum irritation one option would be to make Cmd+left and Cmd+right do the same as Fn+left and Fn+right (even though that feels like a wasteful duplication) and Cmd+up and Cmd+down move to the beginning and end of the document.
OK, change made and will be in the next release. Also perhaps worth mentioning that you can in addition hold down the Shift key to do select to start of line, select to end of line, select to start of document and select to end of document (bearing in mind that 'vertical' selections are whole lines only). Similarly you can hold down Shift with Alt+left and Alt+right to select words.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
Soruk
Posts: 900
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Soruk »

Richard Russell wrote:
Fri Apr 30, 2021 12:33 pm
BigEd wrote:
Fri Apr 30, 2021 11:03 am
BTW, according to my observation, without dumping events, Fn left and right are Home and End, whereas Fn up and down are Prev and Next Page. I use these often.
The Fn key is not recognised by SDL 2.0 so its existence is entirely hidden from me and I can't take any action on a key combination which uses it. I can try asking at the SDL forum whether there's a workaround, but otherwise it's out of my hands.
In my experience (Linux laptop, x86-64 and x86-32), the Fn key sends no signal on its own, but is used in conjunction with other keys to send the keycodes of the key being simulated. For example,. on my netbook, FN-Up is Page Up and FN-Down is Page Down. They send the same X scancodes as a normal desktop PgUp and PgDn respectively and thus indistinguishable. (My miniature USB wireless keyboard even has Fn+Enter send CTRL+Alt+Del.) It also goes without saying that FN+key combinations tend to be very manufacturer - and even keyboard - specific.
Matrix Brandy BASIC VI (work in progress)
User avatar
Richard Russell
Posts: 2230
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Richard Russell »

Soruk wrote:
Sun May 02, 2021 5:43 pm
the Fn key sends no signal on its own, but is used in conjunction with other keys to send the keycodes of the key being simulated.
That's my understanding too, but as I don't have a 'proper' Mac with a Fn key I can't put it to the test. Therefore making Cmd+left and Cmd+right (which I can test) have the same effect as Fn+left and Fn+right I can eliminate any uncertainty.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.
Post Reply

Return to “modern implementations of classic programming languages”