Editor: Intelligent Copy + Paste

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Editor: Intelligent Copy + Paste

Post by Killswitch »

I don't know about you, but when I'm starting a project I often find it nessacary to hardcode in large amounts of information into arrays.

And because of that I usually copy and paste a set I've already completed, like so:

Code: Select all

  Commands(1)\Name="push"
  Commands(1)\Number=1
  Commands(1)\Parameters=1
  Commands(1)\Type[1]=#Type_Any
Of course I have to redefine what each array holds, but thats a given. What bugs me is that I also have to redefine the index of the array. I think it'd be a nice feature if there was a special paste function that automatically updated the index of the array, ala - excell.

A minor thing, but it'd save me a lot of keystrokes :D.
~I see one problem with your reasoning: the fact is thats not a chicken~
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

If I need to have it really large I usually find it more conventiently to store the data in a file or data section and load it at program startup. Or I write a program to output the code for me.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

Yeah I do that too sometimes; however I get a bit parnoid about doing things that way:

1) Adds a layer (unnessacary) complexity to the code
2) Slows down program startup
3) What happens if a file is corrupted or non existant?

I prefer to have it all directly in the code.
~I see one problem with your reasoning: the fact is thats not a chicken~
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

I would like to see it like this:

Code: Select all

Dim Ar.l(5) = {1, 2, 3, 4, 5, 6}
Athlon64 3700+, 1024MB Ram, Radeon X1600
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

remi_meier wrote:I would like to see it like this:

Code: Select all

Dim Ar.l(5) = {1, 2, 3, 4, 5, 6}
Yeah, making an array so easily would be cool, but now it's just a dream. perhaps Fred has something like this in PB4?

I talk too much of PB4 but I am so surprised as Fred promises so good things about it

^Or did he promise a bit too much? :evil:
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

We never promised such stuff, so it's not helpful to mention 'it will may be put in PB4' in every post if you don't know anything about it.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Hi Killswitch.

I know this is the wishlists, but here's a couple of small solutions that may help. Because I am lazy I do this sort of thing. :)

Code: Select all

i=0 : arr(i)="gobble"
i+1 : arr(i)="dy"
i+1 : arr(i)="gook:

; or

i=0
arr(i)\fld1 = 1
...
arr(i)\fld99 = 99
i+1
arr(i)\fld1 = -1
...
arr(i)\fld99 = -99
And then cut and paste for each instance.

An alternative sometimes used: Open a file junksomething.pb and then

Code: Select all

emptyQuote.s =  chr('"') + chr('"')  ; or Chr(34) if you prefer.
For i = 0 to huge
  WriteStringN("Arr(" + Str(i) + ")\StrFld = " + emptyQuote
  WriteStringN("Arr(" + Str(i) + ")\NumFld = "
Next
and then load, select and copy that into the real prog.

Not real clever but cuts down on typos and saves some typing.
@}--`--,-- A rose by any other name ..
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Fred wrote:We never promised such stuff, so it's not helpful to mention 'it will may be put in PB4' in every post if you don't know anything about it.
Calm down, I mean you promise things like:
If you have PB4.0 you don't want to use 3.94 anymore!
or something like that, and I say maybe it's in PB4 because, it would pay you attention and maybe you really add it, it's like catching the fish in the net and feeding it and letting it out of the net. capich? 8)
Post Reply