<Return> Key does not overwrite text selection in any cases

Working on new editor enhancements?
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

<Return> Key does not overwrite text selection in any cases

Post by Axolotl »

Hi Folks
I was trying to reformat

Code: Select all

   If (Right(Directory$, 1) = "\") : Directory$ = Left(Directory$, Len(Directory$)-1) : EndIf 
to

Code: Select all

    If (Right(Directory$, 1) = "\")
      Directory$ = Left(Directory$, Len(Directory$)-1)
    EndIf 
Sometimes the editor overwrites the selected text sometimes not.

Steps to reproduce (5.10 Beta4 (x86)):
1. select for example the spaces and the colon in the first code section (should work with any other piece of code).
2. press the <Enter> or <Return> key
3. the result depends whether there are spaces at the beginning of the line or not (just my observation)

Results from my point of view ...
1. with spaces at the beginning of the line -> not working properly:
2. without spaces -> working correctly
I think it's not a big problem if it remains inside but I'm curious how you see these things.
TIA for some feedback.
Regards Andreas
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
kenmo
Addict
Addict
Posts: 2045
Joined: Tue Dec 23, 2003 3:54 am

Re: <Return> Key does not overwrite text selection in any ca

Post by kenmo »

I've noticed this too, it happens "randomly", I think it started in 5.00 or else the 5.10 betas.

I think it should be considered a bug... it's a weird behaviour that I haven't seen in any other text/code editors.

EDIT - you seem to be right about spaces at the beginning of the line... here's a simpler example:

Code: Select all

If (SomeExpressionHere) : EndIf
1. Highlight "SomeExpressionHere"
2. Press Enter (the expression is cleared)

3. Repeat, but with a space at the beginning of the line
4. Press Enter (the expression remains on the first line)
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: <Return> Key does not overwrite text selection in any ca

Post by MachineCode »

Axolotl wrote:If (Right(Directory$, 1) = "\") : Directory$ = Left(Directory$, Len(Directory$)-1) : EndIf
Here's a shorter way for you:

Code: Select all

Directory$=RTrim(Directory$,"\")
No If/EndIf/Right/Left/Len needed. ;) Just one PureBasic command instead of five.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

Re: <Return> Key does not overwrite text selection in any ca

Post by Axolotl »

Yes, you are right.
I haven't recognized the second parameter by now, thanks. :oops:
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply