Re: [hackers] [st][patch] Increase the buffer size for escape sequences
Hi Roberto, > If we go to increase that size, I would go to use dynamic memory. Having > an array of 1MB statically allocated is a crazy idea Yes it is! > (and it is not C99 compliant, where the maximun allocated size is 128K). That's actually 64k (“at least […] — 65535 bytes in an object (in a hosted environment only)”) ;)
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Tue, Sep 25, 2018 at 10:05 AM Roberto E. Vargas Caballero wrote: > On Mon, Sep 24, 2018 at 05:45:29PM -0700, Eric Pruitt wrote: > > I agree that the current buffer is too small. I'm pretty sure I've run > > into this problem myself with Vim and Bash, but I hadn't gotten around > > to digging into the problem. > > If we go to increase that size, I would go to use dynamic memory. Having > an array of 1MB statically allocated is a crazy idea (and it is not > C99 compliant, where the maximun allocated size is 128K). On my machine, st uses 11MB up to 15MB of memory currently. If we just add 1MB of statically-allocated space it would blow up that size by 9% in some cases so I am also in favor of using dynamic memory there.
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Mon, Sep 24, 2018 at 05:45:29PM -0700, Eric Pruitt wrote: > I agree that the current buffer is too small. I'm pretty sure I've run > into this problem myself with Vim and Bash, but I hadn't gotten around > to digging into the problem. If we go to increase that size, I would go to use dynamic memory. Having an array of 1MB statically allocated is a crazy idea (and it is not C99 compliant, where the maximun allocated size is 128K).
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Mon, Sep 24, 2018 at 10:16:31PM +0200, Ingo Heimbach wrote: > I have recognized that a buffer size of 128*4 bytes is quite small to > store base64 encoded clipboard content (see OSC52), especially when > copying multiple code lines in a terminal editor like vim. I agree that the current buffer is too small. I'm pretty sure I've run into this problem myself with Vim and Bash, but I hadn't gotten around to digging into the problem. Eric
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
I have recognized that a buffer size of 128*4 bytes is quite small to store base64 encoded clipboard content (see OSC52), especially when copying multiple code lines in a terminal editor like vim. 1048576 is 1 mega of 4 byte UTF-8 characters. It is quite big but I simply chose a value that should even be big enough for very large text copy operations. Other values are also OK. The point is that 128*4 bytes are too small for the escape sequence buffer (in my opinion). Best regards, Ingo Am 24. September 2018 17:05:41 MESZ schrieb Laslo Hunhold : >On Mon, 24 Sep 2018 15:52:41 +0100 >"Roberto E. Vargas Caballero" wrote: > >Dear Roberto, > >> I would say, why 1048576 and not 1000? or 1?. >> Is there a specific reason? > >1048576 is 2^20, so it's not completely arbitrary, though the point >really stands as to why there's such a huge jump in size. Can you give >a little information about that, Ingo? > >With best regards > >Laslo > >-- >Laslo Hunhold
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Mon, 24 Sep 2018 15:52:41 +0100 "Roberto E. Vargas Caballero" wrote: Dear Roberto, > I would say, why 1048576 and not 1000? or 1?. > Is there a specific reason? 1048576 is 2^20, so it's not completely arbitrary, though the point really stands as to why there's such a huge jump in size. Can you give a little information about that, Ingo? With best regards Laslo -- Laslo Hunhold
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Sun, Sep 23, 2018 at 03:56:43PM +0200, Ingo Heimbach wrote: > What is incorrect? I would say, why 1048576 and not 1000? or 1?. Is there a specific reason? Roberto
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
What is incorrect? Am 23. September 2018 14:12:23 MESZ schrieb Hiltjo Posthuma : >On Sun, Sep 23, 2018 at 12:12:27PM +0200, Ingo Heimbach wrote: >> Before this commit, long escape sequences (e.g. OSC 52) could be >trimmed >> due to a quite small escape sequence buffer. This commit increases >the >> escape sequence buffer from 128 to 1048576 UTF-8 characters. >> --- >> st.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/st.c b/st.c >> index 46c954b..e9d4536 100644 >> --- a/st.c >> +++ b/st.c >> @@ -31,7 +31,7 @@ >> /* Arbitrary sizes */ >> #define UTF_INVALID 0xFFFD >> #define UTF_SIZ 4 >> -#define ESC_BUF_SIZ (128*UTF_SIZ) >> +#define ESC_BUF_SIZ (1048576*UTF_SIZ) >> #define ESC_ARG_SIZ 16 >> #define STR_BUF_SIZ ESC_BUF_SIZ >> #define STR_ARG_SIZ ESC_ARG_SIZ >> -- >> 2.19.0 >> >> > >This is incorrect. > >-- >Kind regards, >Hiltjo
Re: [hackers] [st][patch] Increase the buffer size for escape sequences
On Sun, Sep 23, 2018 at 12:12:27PM +0200, Ingo Heimbach wrote: > Before this commit, long escape sequences (e.g. OSC 52) could be trimmed > due to a quite small escape sequence buffer. This commit increases the > escape sequence buffer from 128 to 1048576 UTF-8 characters. > --- > st.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/st.c b/st.c > index 46c954b..e9d4536 100644 > --- a/st.c > +++ b/st.c > @@ -31,7 +31,7 @@ > /* Arbitrary sizes */ > #define UTF_INVALID 0xFFFD > #define UTF_SIZ 4 > -#define ESC_BUF_SIZ (128*UTF_SIZ) > +#define ESC_BUF_SIZ (1048576*UTF_SIZ) > #define ESC_ARG_SIZ 16 > #define STR_BUF_SIZ ESC_BUF_SIZ > #define STR_ARG_SIZ ESC_ARG_SIZ > -- > 2.19.0 > > This is incorrect. -- Kind regards, Hiltjo