Would be grate to have a autocomplete for bracket and quotes.
I mean, if I type ( I will get () and the cursor is between the bracket.
If I type () the cursor is behind the brackets.
Autocomplete for bracket and quote
Autocomplete for bracket and quote
macOS Catalina 10.15.7
Re: Autocomplete for bracket and quote
+1
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Re: Autocomplete for bracket and quote
You'll never be able to type () and have the cursor behind the brackets, because as soon as you type the first bracket then the second will be added and the cursor put between them (ie. your first request will be done).Wolfram wrote:if I type ( I will get () and the cursor is between the bracket.
If I type () the cursor is behind the brackets.
Re: Autocomplete for bracket and quote
@Dude:
Think about it again.
1. You type "(" and ")" is appended. The cursor is now inside the brackets.
2. You type ")" and the automatically appended ")" will be overwritten. The cursor is now behind the ")".
P.S. Happy New Year
Think about it again.
1. You type "(" and ")" is appended. The cursor is now inside the brackets.
2. You type ")" and the automatically appended ")" will be overwritten. The cursor is now behind the ")".
P.S. Happy New Year
Last edited by Sicro on Mon Jan 01, 2018 1:41 pm, edited 1 time in total.
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Re: Autocomplete for bracket and quote
Sorry, I don't get it.
After typing "(" the IDE puts "(|)" with the cursor in the middle. Correct? (Note the "|" means cursor).
But then the user then types ")" and the IDE shows "(|))" for a moment, but deletes it and makes it "()|" instead?
Is that right?
After typing "(" the IDE puts "(|)" with the cursor in the middle. Correct? (Note the "|" means cursor).
But then the user then types ")" and the IDE shows "(|))" for a moment, but deletes it and makes it "()|" instead?
Is that right?
Re: Autocomplete for bracket and quote
Yes.Dude wrote:After typing "(" the IDE puts "(|)" with the cursor in the middle. Correct? (Note the "|" means cursor).
Yes, but strictly speaking it looks like this:Dude wrote:But then the user then types ")" and the IDE shows "(|))" for a moment, but deletes it and makes it "()|" instead?
Code: Select all
(|) => Type(")") => ()|) => ()|
Code: Select all
Procedure OnKeyPress(Char$)
Select Char$
Case "("
WriteChar(Char$) ; | => (|
WriteChar(")") ; (| => ()|
SetCursorPos(GetCursorPos() - 1) ; ()| => (|)
Case ")"
If GetCharBeforeCursor() = "(" And GetCharAfterCursor() = ")"
SetCursorPos(GetCursorPos() + 1) ; (|) => ()|
Else
WriteChar(Char$) ; ?|? => ?)|?
EndIf
EndSelect
EndProcedure
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version