Page 1 of 1

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

Posted: Sun Jan 20, 2013 5:45 pm
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

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

Posted: Wed Jan 23, 2013 2:11 am
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)

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

Posted: Tue Jan 29, 2013 4:00 am
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.

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

Posted: Fri Feb 01, 2013 12:16 am
by Axolotl
Yes, you are right.
I haven't recognized the second parameter by now, thanks. :oops: