tags:

views:

232

answers:

1

I wanted to edit just the first line of a 4 MB file. When I open files this large in gedit, it takes a minute or two to load the file but displays and allows you to edit the part that it has loaded so far. So I opened the file, quickly edited the first line, saved the file, and closed gedit all before it was even close to finishing loading the file.

How was it able to save the file before loading it completely? The only way I know of editing files is to load it into memory, edit the copy in memory, then write the whole thing back to the file.

+4  A: 

4MB is not terribly large. It really shouldn't take a minute or two just to load that. It's possible that it loads it all into memory, but then takes a while to get round to displaying it all - the UI widgets may take a while to populate. (Not a minute for a 4MB file, I'd hope, but...)

Maybe that's how it's letting you edit the start and save it quickly - it's finished loading the file, but not finished displaying it.

Jon Skeet