Identation problem [Solved]

Working on new editor enhancements?
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Identation problem [Solved]

Post by Allen »

Hi,

I noticed an identation problem with unicode characters in the editor.

Code: Select all

Procedure Test()
  c$="﹃"
  ReplaceString(a$,b$,c$,,StartPos,1)
  Debug "This line identation is correct"
  ReplaceString(a$,b$,"﹃",,StartPos,1)
                                    Debug "This line identation is incorrect"
EndProcedure
The first Debug line identation is correct. When I replace C$ with the actual unicode character, the next Debug line identation changed.
IDE 5.73 LTS in win 10 pro.

Any suggestion?

Thanks
Last edited by Allen on Wed Feb 09, 2022 5:56 am, edited 1 time in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Identation problem

Post by mk-soft »

Use default Parameter

Code: Select all

a$ = ReplaceString(a$,b$,c$,#PB_String_CaseSensitive,StartPos);,Count)
And check your IDE Preferences:
- Compiler -> defaults -> Source file text encoding -> UTF8
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

Thanks for the reply.

I modify the program and make sure the preference choose UTF-8, the issue still exists. ANy suggestion?

Image
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Identation problem

Post by #NULL »

The preferences settings is a default setting, i.e. for new files. For the current file check File > File format.
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

@#Null, Thanks for advice.

I checked and found the setting is already UTF-8, any setting do I missed?

Image
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

I did some more test and found it is also related to the number of parameters of replacestring().

Code: Select all

Procedure Test()
  c$="﹃"
  ReplaceString(a$,b$,c$,#PB_String_InPlace,StartPos,1)
  Debug "This line identation is correct"
  ReplaceString(a$,B$,"﹃",#PB_String_InPlace)
  Debug "This line identation is correct"
  ReplaceString(a$,B$,"﹃",#PB_String_InPlace,startpos)
  Debug "This line identation is correct"
  ReplaceString(a$,B$,"﹃",#PB_String_InPlace,startpos,1)
                                                      Debug "This line identation is incorrect"
EndProcedure
Thanks
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Identation problem

Post by #NULL »

I'm on linux / can't reproduce, so I will just ask: How did you get that indentation? Is that the result you get with Cntrl+A Cntrl+I (select all, format indentation)?
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

I get the identation by just entering the text line by line. If I modify the identation manually, using CTL-A,CTL-I will restore to the original condition.
#NULL
Addict
Addict
Posts: 1499
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Identation problem

Post by #NULL »

I'm not sure what you mean by 'original condition', is it right or wrong then?
What happens if you delete the line breaks and whitespaces between the lines and press Enter again? Is the result different if you use simpler characters in the string literal?
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

Original condition means the same condition (wrong) as I enter line by line. If I edit the line manually, (delete space before debug), it will changed back to the wrong condition after CTL-A, CTL-I.

Replace the unicode char with an normal ASCII char, the problem goes away.

Image
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

I did more test and found:

1) The problem only occur if I use ONE unicode char, it goes away if I use two or more unicode char.
2) Adding ASCII char and ONE unicode char will affect the isentation of next line.

Image
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Identation problem

Post by mk-soft »

No problems here under Windows 10 Pro
and PB v5.73 and v6.00

Check your character set and indentation setting.

If necessary, delete your preferences from PB and have PB-IDE recreate them.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

Mk-soft, thanks for the clarification.

Please advise how to delete the IDE preference, I try re-install PureBasic and still have the same issue.

Thanks.
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Identation problem

Post by mk-soft »

- open file explorer
- write %appdata% in address field and enter
- open folder purebasic
- delete file purebasic.prefs

Before delete this file export your colors over pb-ide preferences
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Allen
Enthusiast
Enthusiast
Posts: 103
Joined: Wed Nov 10, 2021 2:05 am

Re: Identation problem

Post by Allen »

I delete the preference file and reload IDE and the test file, the problem still exist. It may be due to the character set I used, will look into it later. Anyway, it is good to confirm it is not an iDE issue and I do learn how to reset the IDE setting (delete the preference file) :) .

Mk-Soft and #Null, thank you for your help.

Allen
Post Reply