emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Puzzling behavior from echo area: truncates prompt string at 100 cha


From: Andreas Schwab
Subject: Re: Puzzling behavior from echo area: truncates prompt string at 100 characters?
Date: Sat, 24 Dec 2011 11:59:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> This limitation was there since 1991, but AFAICS it is not documented
> anywhere.

I don't think this was a deliberate decision, just sloppy coding.

> Do we want to keep this limitation?  If so, it should be at least
> documented.

I can trivially be lifted:

diff --git a/src/callint.c b/src/callint.c
index 80e24f6..8dcf9a6 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -274,7 +274,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   ptrdiff_t i, nargs;
   int foo;
-  char prompt1[100];
   char *tem1;
   int arg_from_tty = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -491,13 +490,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
   tem = string;
   for (i = 1; *tem; i++)
     {
-      strncpy (prompt1, tem + 1, sizeof prompt1 - 1);
-      prompt1[sizeof prompt1 - 1] = 0;
-      tem1 = strchr (prompt1, '\n');
-      if (tem1) *tem1 = 0;
-
-      visargs[0] = build_string (prompt1);
-      if (strchr (prompt1, '%'))
+      visargs[0] = make_string (tem + 1, strcspn (tem + 1, "\n"));
+      if (strchr (SSDATA (visargs[0]), '%'))
        callint_message = Fformat (i, visargs);
       else
        callint_message = visargs[0];

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]