What is the shortcut to create EndEnumeration automatically?

Working on new editor enhancements?
User avatar
Oso
User
User
Posts: 66
Joined: Wed Jul 20, 2022 10:09 am

What is the shortcut to create EndEnumeration automatically?

Post by Oso »

I'm using some of the training videos in a Youtube channel PureProgramming. In a number of examples, the author creates matching blocks of code such as Enumeration and EndEnumeration, but doesn't explain the keyboard shortcut responsible for automatically creating the matching EndEnumeration.

Any ideas how to invoke that? The PureBasic documentation covering Autocomplete on page 56 seems to get very close to explaining it.

For what it's worth, the example is at 2:46 in the video https://www.youtube.com/watch?v=0NsT1WWS6F8

Incidentally, are there any other training resources available? Thanks
User avatar
Demivec
Addict
Addict
Posts: 3924
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: What is the shortcut to create EndEnumeration automatically?

Post by Demivec »

Oso wrote: Tue Jul 26, 2022 1:21 am I'm using some of the training videos in a Youtube channel PureProgramming. In a number of examples, the author creates matching blocks of code such as Enumeration and EndEnumeration, but doesn't explain the keyboard shortcut responsible for automatically creating the matching EndEnumeration.

Any ideas how to invoke that? The PureBasic documentation covering Autocomplete on page 56 seems to get very close to explaining it.

For what it's worth, the example is at 2:46 in the video https://www.youtube.com/watch?v=0NsT1WWS6F8

Incidentally, are there any other training resources available? Thanks
You can find in the help file under 'Customizing the IDE':
Add matching ‘End' keyword if Tab/Enter is pressed twice
If you press Tab or Enter twice, it will insert the corresponding end keyword (for example "EndSelect" to "Select" or "EndIf " to "If") to the keyword you have just inserted. The end keyword will be inserted after the cursor, so you can continue typing after the first keyword that was inserted.
User avatar
Oso
User
User
Posts: 66
Joined: Wed Jul 20, 2022 10:09 am

Re: What is the shortcut to create EndEnumeration automatically?

Post by Oso »

Demivec wrote: Tue Jul 26, 2022 3:30 am If you press Tab or Enter twice, it will insert the corresponding end keyword (for example "EndSelect" to "Select" or "EndIf " to "If") to the keyword you have just inserted. The end keyword will be inserted after the cursor, so you can continue typing after the first keyword that was inserted.
That's great, thanks very much, it works but there's an error in the documentation and in the IDE settings screen that had me repeatedly trying 'INSERT twice' last night, because that's what it says on the screen and also in that text "Customizing the IDE".

Screenshot : Add matching 'End' keyword if INSERT pressed twice


I'd been trying this setting , but it says "... if Insert is pressed twice". Also, it's necessary to enable that setting "Add matching 'End' keyword if Insert pressed twice", to get the double-Tab function to work! It seems the screen setting and the documentation haven't been corrected to match the actual behaviour. Pressing INSERT twice doesn't work either.
Little John
Addict
Addict
Posts: 4103
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: What is the shortcut to create EndEnumeration automatically?

Post by Little John »

You are right. This currently only works with the [Tab] key, but neither with the [Enter] nor with the [Insert] key.
However, I would appreciate it if pressing [Enter] twice would optionally have this effect. For me personally, pressing [Enter] twice in that situation is much more „natural“ than pressing [Tab]. Actually, I never press [Tab] in an editor at all. :D
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups
User avatar
spikey
Enthusiast
Enthusiast
Posts: 431
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: What is the shortcut to create EndEnumeration automatically?

Post by spikey »

Little John wrote: Tue Jul 26, 2022 3:36 pmThis currently only works with the [Tab] key
Actually it uses the same shortcut key as defined in the preferences dialog for selecting an item from the Autocomplete menu, that's what it means by 'Insert'. (See Preferences - General - Shortcuts. Scroll almost to the bottom of the list -'Insert the selected autocomplete word'). If you can live with an alteration to this you can customise the closure behaviour. But yes, the documentation isn't properly descriptive of this and could do with an edit.
Little John
Addict
Addict
Posts: 4103
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: What is the shortcut to create EndEnumeration automatically?

Post by Little John »

Spikey, thank you for the explanation and correction.
Setting [Enter] there as shortcut works fine. :-)

Not “only” the documentation needs to be corrected, but also the Preferences dialog.
The way how the word “Insert” is used in the English text in this context is confusing.

And when German is selected as language in the IDE, it reads
Einstellungen > Editor > Automatisches Vervollständigen wrote: [ ] Zugehöriges 'End'-Schlüsselwort hinzufügen, wenn 2x Tab gedrückt wird
even after setting the shortcut to [Enter].
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups
User avatar
Oso
User
User
Posts: 66
Joined: Wed Jul 20, 2022 10:09 am

Re: What is the shortcut to create EndEnumeration automatically?

Post by Oso »

Little John wrote: Tue Jul 26, 2022 6:49 pm Not “only” the documentation needs to be corrected, but also the Preferences dialog.
The way how the word “Insert” is used in the English text in this context is confusing.
I agree with your point entirely, the Preferences dialog had me spending some time experimenting with the Insert key. It says "... if insert is pressed twice". If that doesn't imply the pressing of an explicit key, then I think there's something wrong. What it "means" is unimportant -- it's how users interpret it that matters.

I think it would be better if it said, "if the insert function is pressed" or perhaps better still "invoked", rather than the "insert key".

As for the documentation, that is also quite wrong. It states that TAB or ENTER may be pressed twice. It can't be both -- it's a single shortcut key and it depends entirely on what it's currently set to. The default appears to be TAB, but certainly ENTER doesn't work...

"Add matching ‘End' keyword if Tab/Enter is pressed twice
If you press Tab or Enter twice, it will insert the corresponding end keyword"
User avatar
spikey
Enthusiast
Enthusiast
Posts: 431
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: What is the shortcut to create EndEnumeration automatically?

Post by spikey »

I've posted a couple of bug reports.
Post Reply