One key source reformat

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

One key source reformat

Post by blueznl »

This one says it all: http://www.purebasic.fr/english/viewtop ... 13&t=55624 :-)

Anyway, I would like:

A full reformat of the whole code, upon pressing a shortcut key, with AFTER the reformat NOTHING selected and the cursor (as far as possible) on its original place. That would allow a quick Alt+R or something similar and just continue coding.

Yes, I know CTRL+F2 CTRL+A CTRL+I F2 mostly does this, but a single keypress would even be better.

(I could stick to CodeCaddy's reformatting, but I like the way the IDE does multiline code, and I'm just not in the mood to rewrite my own reformatting code :-))
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: One key source reformat

Post by Danilo »

Could use the same menu. With text selection, the selected text gets re-formatted. Without selected text, the whole source gets re-formatted.
I first thought this IDE menu does not work, because I tried without selected text and nothing happened... ;)
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: One key source reformat

Post by Josh »

Bad idea. In some cases I'm using my own formatting and it would be horrible, if one mistype destroy my formatting when I'm on a place where I can't check the changes.

I need this function only, if I'm testing a foreign codes.
sorry for my bad english
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: One key source reformat

Post by Danilo »

Josh wrote:if one mistype destroy my formatting
...you can go back with Undo (CTRL+Z), like always after mistyping something. ;)

Just saying that I expected code re-formatting to work without a selection, like in other editors.
However it is done, I also would like to see blueznl's wish implemented. New shortcut key is OK with me,
but using the same menu/key for it is more logical to me. Same thing: re-formatting. With selection and without.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: One key source reformat

Post by Josh »

Danilo wrote:
Josh wrote:if one mistype destroy my formatting
...you can go back with Undo (CTRL+Z), like always after mistyping something. ;)
Josh wrote:... when I'm on a place where I can't check the changes.
What doe's CTRL+Z help, if I'm coding on a place where I don't check the changes and see two hours later the broken formatting.
sorry for my bad english
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: One key source reformat

Post by Danilo »

Josh wrote:What doe's CTRL+Z help, if I'm coding on a place where I don't check the changes and see two hours later the broken formatting.
So it would be better for you to make this two separate shortcut keys and menus to do the same thing. You could disable the hotkey for reformat without selection then...
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: One key source reformat

Post by Josh »

Danilo wrote:So it would be better for you to make this two separate shortcut keys and menus to do the same thing. You could disable the hotkey for reformat without selection then...
Ok, here you are right :D
Generally I think, CTRL+A CTRL+I is ok. I don't think, that CTRL+A has something to do, that PB changes to the end of code. So it would be fine, when the code after CTRL+I is shown at the same position like before.
sorry for my bad english
Post Reply