comparison src/undo.c @ 10518:de77fa909414 v8.0.0149

commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 7 16:14:57 2017 +0100 patch 8.0.0149: :earlier does not work after reading the undo file Problem: ":earlier" and ":later" do not work after startup or reading the undo file. Solution: Use absolute time stamps instead of relative to the Vim start time. (Christian Brabandt, Pavel Juhas, closes #1300, closes #1254)
author Christian Brabandt <cb@256bit.org>
date Sat, 07 Jan 2017 16:30:04 +0100
parents 66f1b5bf3fa6
children cbf17371627c
comparison
equal deleted inserted replaced
10517:35370d9e40c1 10518:de77fa909414
2296 target = step; 2296 target = step;
2297 closest = -1; 2297 closest = -1;
2298 } 2298 }
2299 else 2299 else
2300 { 2300 {
2301 /* When doing computations with time_t subtract starttime, because
2302 * time_t converted to a long may result in a wrong number. */
2303 if (dosec) 2301 if (dosec)
2304 target = (long)(curbuf->b_u_time_cur - starttime) + step; 2302 target = (long)(curbuf->b_u_time_cur) + step;
2305 else if (dofile) 2303 else if (dofile)
2306 { 2304 {
2307 if (step < 0) 2305 if (step < 0)
2308 { 2306 {
2309 /* Going back to a previous write. If there were changes after 2307 /* Going back to a previous write. If there were changes after
2348 closest = -1; 2346 closest = -1;
2349 } 2347 }
2350 else 2348 else
2351 { 2349 {
2352 if (dosec) 2350 if (dosec)
2353 closest = (long)(vim_time() - starttime + 1); 2351 closest = (long)(vim_time() + 1);
2354 else if (dofile) 2352 else if (dofile)
2355 closest = curbuf->b_u_save_nr_last + 2; 2353 closest = curbuf->b_u_save_nr_last + 2;
2356 else 2354 else
2357 closest = curbuf->b_u_seq_last + 2; 2355 closest = curbuf->b_u_seq_last + 2;
2358 if (target >= closest) 2356 if (target >= closest)
2386 2384
2387 while (uhp != NULL) 2385 while (uhp != NULL)
2388 { 2386 {
2389 uhp->uh_walk = mark; 2387 uhp->uh_walk = mark;
2390 if (dosec) 2388 if (dosec)
2391 val = (long)(uhp->uh_time - starttime); 2389 val = (long)(uhp->uh_time);
2392 else if (dofile) 2390 else if (dofile)
2393 val = uhp->uh_save_nr; 2391 val = uhp->uh_save_nr;
2394 else 2392 else
2395 val = uhp->uh_seq; 2393 val = uhp->uh_seq;
2396 2394