undo: update undo_time() function signature

sec,file,absolute (params) are bool.
Fix callers and local variables of undo_time().
This commit is contained in:
Jan Edmund Lazo
2018-08-20 23:36:36 -04:00
parent 19717ca1e8
commit 6f55aa3502
2 changed files with 23 additions and 25 deletions

View File

@@ -7578,7 +7578,7 @@ static void ex_bang(exarg_T *eap)
static void ex_undo(exarg_T *eap) static void ex_undo(exarg_T *eap)
{ {
if (eap->addr_count == 1) /* :undo 123 */ if (eap->addr_count == 1) /* :undo 123 */
undo_time(eap->line2, FALSE, FALSE, TRUE); undo_time(eap->line2, false, false, true);
else else
u_undo(1); u_undo(1);
} }
@@ -7613,8 +7613,8 @@ static void ex_redo(exarg_T *eap)
static void ex_later(exarg_T *eap) static void ex_later(exarg_T *eap)
{ {
long count = 0; long count = 0;
int sec = FALSE; bool sec = false;
int file = FALSE; bool file = false;
char_u *p = eap->arg; char_u *p = eap->arg;
if (*p == NUL) if (*p == NUL)
@@ -7622,11 +7622,11 @@ static void ex_later(exarg_T *eap)
else if (isdigit(*p)) { else if (isdigit(*p)) {
count = getdigits_long(&p); count = getdigits_long(&p);
switch (*p) { switch (*p) {
case 's': ++p; sec = TRUE; break; case 's': ++p; sec = true; break;
case 'm': ++p; sec = TRUE; count *= 60; break; case 'm': ++p; sec = true; count *= 60; break;
case 'h': ++p; sec = TRUE; count *= 60 * 60; break; case 'h': ++p; sec = true; count *= 60 * 60; break;
case 'd': ++p; sec = TRUE; count *= 24 * 60 * 60; break; case 'd': ++p; sec = true; count *= 24 * 60 * 60; break;
case 'f': ++p; file = TRUE; break; case 'f': ++p; file = true; break;
} }
} }
@@ -7634,7 +7634,7 @@ static void ex_later(exarg_T *eap)
EMSG2(_(e_invarg2), eap->arg); EMSG2(_(e_invarg2), eap->arg);
else else
undo_time(eap->cmdidx == CMD_earlier ? -count : count, undo_time(eap->cmdidx == CMD_earlier ? -count : count,
sec, file, FALSE); sec, file, false);
} }
/* /*

View File

@@ -1804,16 +1804,14 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
u_undo_end(undo_undoes, false, quiet); u_undo_end(undo_undoes, false, quiet);
} }
/* // Undo or redo over the timeline.
* Undo or redo over the timeline. // When "step" is negative go back in time, otherwise goes forward in time.
* When "step" is negative go back in time, otherwise goes forward in time. // When "sec" is false make "step" steps, when "sec" is true use "step" as
* When "sec" is FALSE make "step" steps, when "sec" is TRUE use "step" as // seconds.
* seconds. // When "file" is true use "step" as a number of file writes.
* When "file" is TRUE use "step" as a number of file writes. // When "absolute" is true use "step" as the sequence number to jump to.
* When "absolute" is TRUE use "step" as the sequence number to jump to. // "sec" must be false then.
* "sec" must be FALSE then. void undo_time(long step, bool sec, bool file, bool absolute)
*/
void undo_time(long step, int sec, int file, int absolute)
{ {
long target; long target;
long closest; long closest;
@@ -1825,8 +1823,8 @@ void undo_time(long step, int sec, int file, int absolute)
int mark; int mark;
int nomark; int nomark;
int round; int round;
int dosec = sec; bool dosec = sec;
int dofile = file; bool dofile = file;
bool above = false; bool above = false;
bool did_undo = true; bool did_undo = true;
@@ -1867,7 +1865,7 @@ void undo_time(long step, int sec, int file, int absolute)
if (target <= 0) if (target <= 0)
/* Go to before first write: before the oldest change. Use /* Go to before first write: before the oldest change. Use
* the sequence number for that. */ * the sequence number for that. */
dofile = FALSE; dofile = false;
} else { } else {
/* Moving forward to a newer write. */ /* Moving forward to a newer write. */
target = curbuf->b_u_save_nr_cur + step; target = curbuf->b_u_save_nr_cur + step;
@@ -1875,7 +1873,7 @@ void undo_time(long step, int sec, int file, int absolute)
/* Go to after last write: after the latest change. Use /* Go to after last write: after the latest change. Use
* the sequence number for that. */ * the sequence number for that. */
target = curbuf->b_u_seq_last + 1; target = curbuf->b_u_seq_last + 1;
dofile = FALSE; dofile = false;
} }
} }
} else } else
@@ -2014,8 +2012,8 @@ void undo_time(long step, int sec, int file, int absolute)
} }
target = closest_seq; target = closest_seq;
dosec = FALSE; dosec = false;
dofile = FALSE; dofile = false;
if (step < 0) { if (step < 0) {
above = true; // stop above the header above = true; // stop above the header
} }