diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-27 05:12:45 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-27 05:12:45 +0100 |
commit | 52410575be50d5c40bbe6380159df48cfc382ceb (patch) | |
tree | f8a212edd951fa1df961da74870bc9c172dc0b01 /src/undo.c | |
parent | dfded98f87601b11271ee88392c821ceb6390eda (diff) | |
download | vim-git-52410575be50d5c40bbe6380159df48cfc382ceb.tar.gz |
patch 8.1.2225: the "last used" info of a buffer is under usedv8.1.2225
Problem: The "last used" info of a buffer is under used.
Solution: Add "lastused" to getbufinfo(). List buffers sorted by last-used
field. (Andi Massimino, closes #4722)
Diffstat (limited to 'src/undo.c')
-rw-r--r-- | src/undo.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/undo.c b/src/undo.c index 2736f2a33..64fb2050c 100644 --- a/src/undo.c +++ b/src/undo.c @@ -106,7 +106,6 @@ static void u_getbot(void); static void u_doit(int count); static void u_undoredo(int undo); static void u_undo_end(int did_undo, int absolute); -static void u_add_time(char_u *buf, size_t buflen, time_t tt); static void u_freeheader(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); static void u_freebranch(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); static void u_freeentries(buf_T *buf, u_header_T *uhp, u_header_T **uhpp); @@ -2973,7 +2972,7 @@ u_undo_end( if (uhp == NULL) *msgbuf = NUL; else - u_add_time(msgbuf, sizeof(msgbuf), uhp->uh_time); + add_time(msgbuf, sizeof(msgbuf), uhp->uh_time); #ifdef FEAT_CONCEAL { @@ -3050,7 +3049,7 @@ ex_undolist(exarg_T *eap UNUSED) break; vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ", uhp->uh_seq, changes); - u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), + add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), uhp->uh_time); if (uhp->uh_save_nr > 0) { @@ -3125,37 +3124,6 @@ ex_undolist(exarg_T *eap UNUSED) } /* - * Put the timestamp of an undo header in "buf[buflen]" in a nice format. - */ - static void -u_add_time(char_u *buf, size_t buflen, time_t tt) -{ -#ifdef HAVE_STRFTIME - struct tm tmval; - struct tm *curtime; - - if (vim_time() - tt >= 100) - { - curtime = vim_localtime(&tt, &tmval); - if (vim_time() - tt < (60L * 60L * 12L)) - /* within 12 hours */ - (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); - else - /* longer ago */ - (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime); - } - else -#endif - { - long seconds = (long)(vim_time() - tt); - - vim_snprintf((char *)buf, buflen, - NGETTEXT("%ld second ago", "%ld seconds ago", seconds), - seconds); - } -} - -/* * ":undojoin": continue adding to the last entry list */ void |