mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
vim-patch:8.1.2225: the "last used" info of a buffer is under used
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 vim/vim#4722)
52410575be
This commit is contained in:
@@ -2441,10 +2441,11 @@ static void u_undo_end(
|
||||
uhp = curbuf->b_u_newhead;
|
||||
}
|
||||
|
||||
if (uhp == NULL)
|
||||
if (uhp == NULL) {
|
||||
*msgbuf = NUL;
|
||||
else
|
||||
u_add_time(msgbuf, sizeof(msgbuf), uhp->uh_time);
|
||||
} else {
|
||||
add_time(msgbuf, sizeof(msgbuf), uhp->uh_time);
|
||||
}
|
||||
|
||||
{
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
@@ -2509,8 +2510,8 @@ void ex_undolist(exarg_T *eap)
|
||||
&& uhp->uh_walk != mark) {
|
||||
vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7d ",
|
||||
uhp->uh_seq, changes);
|
||||
u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff),
|
||||
uhp->uh_time);
|
||||
add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff),
|
||||
uhp->uh_time);
|
||||
if (uhp->uh_save_nr > 0) {
|
||||
while (STRLEN(IObuff) < 33)
|
||||
STRCAT(IObuff, " ");
|
||||
@@ -2574,30 +2575,6 @@ void ex_undolist(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
struct tm curtime;
|
||||
|
||||
if (time(NULL) - tt >= 100) {
|
||||
os_localtime_r(&tt, &curtime);
|
||||
if (time(NULL) - 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 {
|
||||
int64_t seconds = time(NULL) - tt;
|
||||
vim_snprintf((char *)buf, buflen,
|
||||
NGETTEXT("%" PRId64 " second ago",
|
||||
"%" PRId64 " seconds ago", (uint32_t)seconds),
|
||||
seconds);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ":undojoin": continue adding to the last entry list
|
||||
*/
|
||||
|
Reference in New Issue
Block a user