On Wed, Jan 11, 2012 at 12:33 PM, Martti Kühne <mysatyre_AT_gmail.com> wrote:
> Debugging ttywrite() got me thinking, why is it that pressing Enter will not
> result in what would seem logical '\n' but '\r' as well instead?
> tty(1) mentions CR, though I'm completely lost if/why that be the right place.
See
http://vt100.net/docs/vt102-ug/chapter3.html#S3.6.3.11
> --- st/st.c 2011-11-02 21:24:08.893374099 +0100
> +++ st-nanopaste/st.c 2012-01-11 12:13:15.011070888 +0100
> _AT_@ -500,7 +500,7 @@
> void
> selnotify(XEvent *e) {
> unsigned long nitems, ofs, rem;
> - int format;
> + int format, i;
> unsigned char *data;
> Atom type;
>
> _AT_@ -512,6 +512,9 @@
> fprintf(stderr, "Clipboard allocation failed\n");
> return;
> }
> + for(i = 0; i < nitems * format / 8; i++)
> + if(data[i] == '\n')
> + data[i] = '\r';
> ttywrite((const char *) data, nitems * format / 8);
> XFree(data);
> /* number of 32-bit chunks returned */
>
I'll have a look at this.
Received on Wed Jan 11 2012 - 15:13:32 CET