Place spaces around operators (?)

Just starting out? Need help? Post your questions and find answers here.
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

Should be fixed now also.

I've integrated a backup functionality, because while testing some procedures I corrupted my code by accident.
That shouldn't happen with the release version of course, but well... who knows.

By default it will hold 5 backups, no matter which file you indented.
They are in %TEMP%/smartindent/ and the backup_1.pb is always the latest.
How about the English name e.g. TidyPB?
Yeah, will do that the moment you start using english comments in all your codes :mrgreen:
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Place spaces around operators (?)

Post by ChrisR »

Great, thank you for waking your nice TidyPB up :)
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Place spaces around operators (?)

Post by Caronte3D »

Very useful tool :wink:
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: Place spaces around operators (?)

Post by zikitrake »

Thanks a million for this useful tool!
PB 6.21 beta, PureVision User
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Place spaces around operators (?)

Post by AZJIO »

HeX0R
v1.12

Code: Select all

wParam&$FF
wParam~$FF
wParam*$FF
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Place spaces around operators (?)

Post by BarryG »

AZJIO wrote: Mon Feb 21, 2022 2:46 pmAre there any features to fix this situation?
It's not actually a fault to be "fixed"; it's just a personal coding preference. I myself prefer no spaces around operators.
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

AZJIO wrote: Thu Mar 10, 2022 12:15 am HeX0R
v1.12
In fact it is v1.14 already (might have missed to upload some versions).

Code: Select all

wParam~$FF
That is no valid code!
I've integrated the others.

It's a little tricky to distinguish between pointernames and multiplication signs, therefore the star (*) is not perfectly working.
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Place spaces around operators (?)

Post by AZJIO »

The PureBasic help says that you can get a handle to Scintilla if you run it as a tool

Code: Select all

MessageRequester("", GetEnvironmentVariable("PB_TOOL_Scintilla"))
you can paste the result into the document window.
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

I know that, but it's not needed for that tool.
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

improved star (*) handling
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Place spaces around operators (?)

Post by AZJIO »

I did not quite understand some things in the screenshots, but it did not work for me:
"%TEMPFILE"
I figured it out, I had to check the boxes
You need to take a screenshot in the first post and mark the checkboxes with a red circle.
Image
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

Usually I'd included this here, then installation is just one click away.
But here I thought it is simple enough.

@Mods:
It might be worth to move that discussion about that tool into a new one, somewhere in... dunno, Applications Feedback & Discussions?
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Place spaces around operators (?)

Post by AZJIO »

Code: Select all

Repeat
	AddElement(StringList())
	p = FindString(S\s, Separator)
	StringList() = PeekS(*S\i, p - 1)
	*S\i + (p + slen - 1) << #PB_Compiler_Unicode
Until p = 0
There are many spaces before the "=" sign.
Is it possible to make a parameter to disable "=" alignment?
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Place spaces around operators (?)

Post by HeX0R »

Added -noequalalign command parameter
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Place spaces around operators (?)

Post by AZJIO »

Code: Select all

ButtonGadget (#btnOpnFile, 480, 40, 30, 30, "...")
ButtonGadget(#btnOpnFile, 480, 40, 30, 30, "...")
space before opening bracket
Post Reply