Author Topic: The "Backup/Undo" option  (Read 2648 times)

0 Members and 1 Guest are viewing this topic.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
The "Backup/Undo" option
« on: March 19, 2019, 11:54:17 am »
The IDE - Options offers a few choices one of which is "Backup/Undo". This option further offers - Undo Buffer Limit (10 - 2000 MB). What exactly does this option do? Is there one limit better than another? Thanks

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: The "Backup/Undo" option
« Reply #1 on: March 19, 2019, 12:49:05 pm »
Undo basically saves each change as you make it, so you can undo it.

Type the following program for example:

PRINT “Hello World”


Undo will basically save a series of the following changes to a file:

(Blank, empty file)
PRINT
PRINT “
PRINT “Hello
PRINT “Hello World
PRINT “Hello World”

5 changes saved, so if you ctrl-z (Undo), you can step back through your program to undo alterations.

****************

As for the buffer limit, the size you want depends on a few things:

1) Your program size itself.  Write a 200,000 line program, you’ll probably want a larger buffer than if you’re writing a 20 line program.

2) If you cut/paste large chunks of code at once.  Larger cut/pastes use the buffer quicker, as there’s big chunks of changes being saved for each step.  If you cut/paste 1MB of code, with a 10MB undo limit, you may only have a very limited number of ctrl-z uses, before you hit the limit.

3) The number of times you need to undo changes.  If you ctrl-z just one or two minor changes (such as to correct a typo on a line), you don’t need a large buffer.  If you’re like me, and ctrl-z from start to finish through a program to debug it, you need a larger buffer to store EVERY change and not just the last 20, or so.

4) Hard Drive space.  If QB64 is on a USB Drive, you might not want a 2GB undo file.  If it’s on a 16TB drive, that amount probably means squat.

So the answer, in the end, is, “It all depends on your needs, style, and drive limits.”

For me, personally, the first thing I usually do is up that limit to at least 1000MB, and usually, I just go ahead and set it to the max 2000MB.  I have 8 hard drives sequenced to my PC (I’m a notorious digital pack rat), so 2GB per instillation of QB64 on them isn’t anything to worry over, and it allows me to back up as much as I want, without any concerns of hitting the undo limit.

Just choose what works best for you.  If you have a lot of drive space, go ahead and up it without worry.  Otherwise, just set it to the size you can spare, and remember that the number of times you can ctrl-z before hitting the limit of changes is going to be reduced the smaller you make that file.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: The "Backup/Undo" option
« Reply #2 on: March 19, 2019, 01:27:48 pm »
Thanks very much Steve. I thought there may be a formula which equates lines of code to size of butter - ie 10,000 lines of code to every 100 mb of buffer or something along those lines.