Hi,
2013/10/02 Wed 19:52:29 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
>
> > Hi,
> >
> > Sometimes (maybe when scrolling occurs) undo messages like
> > "2 fewer lines: before #79 7 seconds ago" are not shown.
> > (Vim 7.4.041 on Windows, 7.3.429 on Linux)
> >
> > E.g.
> >
> > 1. $ gvim -N -u NONE -U NONE
> > 2. Input a line: `ifoo<CR><Esc>`.
> > 3. Repeat it more than 25 times (= more than the screen lines) using `.`.
> > 4. Go to the first line using `gg`, then undo by using `u`.
> > Undo message will not be shown.
> > 5. Repeat `ggu` several times.
> > Undo message will be shown if the file lines becomes fewer than the
> > screen
> > lines.
> >
> > Attached patch seems to fix this, but I'm not sure this is the best way.
>
> No, this forces a redraw of the whole screen. It works because instead
> of deleting lines, which causes the message to scroll up and be cleared,
> it overwrites the screen.
>
> It's better to find a way to fill keep_msg. Unfortunately there is no
> asy way to call smsg() and have msg_attr_keep() called with "keep" set
> to TRUE. A global variable would be the easyest, but it's ugly.
Then I think it's better to add a new function smsg_attr_keep().
Please check the attached patch.
BTW, Yukihiro Nakadaira found an easier way to reproduce the problem:
$ vim -u NONE -N
Ofoo<Esc>..uuu
Now we don't need to repeat `.` 25 times ;-)
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# Parent e182ca7f57a0e48d8b3d85a143b8cee04505d476
diff --git a/src/message.c b/src/message.c
--- a/src/message.c
+++ b/src/message.c
@@ -339,8 +339,8 @@
/*
* Automatic prototype generation does not understand this function.
- * Note: Caller of smgs() and smsg_attr() must check the resulting string is
- * shorter than IOSIZE!!!
+ * Note: Caller of smgs(), smsg_attr() and smsg_attr_keep() must check the
+ * resulting string is shorter than IOSIZE!!!
*/
#ifndef PROTO
# ifndef HAVE_STDARG_H
@@ -357,6 +357,12 @@
#endif
smsg_attr __ARGS((int, char_u *, long, long, long,
long, long, long, long, long, long, long));
+int
+#ifdef __BORLANDC__
+_RTLENTRYF
+#endif
+smsg_attr_keep __ARGS((int, int, char_u *, long, long, long,
+ long, long, long, long, long, long, long));
int vim_snprintf __ARGS((char *, size_t, char *, long, long, long,
long, long, long, long, long, long, long));
@@ -389,9 +395,24 @@
char_u *s;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
{
+ return smsg_attr_keep(0, FALSE, s,
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+}
+
+/* VARARGS */
+ int
+#ifdef __BORLANDC__
+_RTLENTRYF
+#endif
+smsg_attr_keep(attr, keep, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+ int attr;
+ int keep;
+ char_u *s;
+ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
+{
vim_snprintf((char *)IObuff, IOSIZE, (char *)s,
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
- return msg_attr(IObuff, attr);
+ return msg_attr_keep(IObuff, attr, keep);
}
# else /* HAVE_STDARG_H */
@@ -426,6 +447,20 @@
return msg_attr(IObuff, attr);
}
+ int
+#ifdef __BORLANDC__
+_RTLENTRYF
+#endif
+smsg_attr_keep(int attr, int keep, char_u *s, ...)
+{
+ va_list arglist;
+
+ va_start(arglist, s);
+ vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL);
+ va_end(arglist);
+ return msg_attr_keep(IObuff, attr, keep);
+}
+
# endif /* HAVE_STDARG_H */
#endif
diff --git a/src/proto.h b/src/proto.h
--- a/src/proto.h
+++ b/src/proto.h
@@ -120,6 +120,12 @@
# ifdef __BORLANDC__
_RTLENTRYF
# endif
+smsg_attr_keep __ARGS((int, int, char_u *, ...));
+
+int
+# ifdef __BORLANDC__
+_RTLENTRYF
+# endif
vim_snprintf_add __ARGS((char *, size_t, char *, ...));
int
diff --git a/src/undo.c b/src/undo.c
--- a/src/undo.c
+++ b/src/undo.c
@@ -2729,7 +2729,7 @@
}
#endif
- smsg((char_u *)_("%ld %s; %s #%ld %s"),
+ smsg_attr_keep(0, TRUE, (char_u *)_("%ld %s; %s #%ld %s"),
u_oldcount < 0 ? -u_oldcount : u_oldcount,
_(msgstr),
did_undo ? _("before") : _("after"),