Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-06 Thread Roberto E. Vargas Caballero
Hi,

On Mon, Feb 06, 2023 at 08:45:27AM +0200, Santtu Lakkala wrote:
> > tsetattr(csiescseq.arg, csiescseq.narg);
> > break;
> > -   case 'n': /* DSR – Device Status Report (cursor position) */
> > -   if (csiescseq.arg[0] == 6) {
> > +   case 'n': /* DSR – Device Status Report */
> > +   switch (csiescseq.arg[0]) {
> > +   case 5: /* Status Report "OK" `0n` */
> > +   ttywrite("\033[0n", sizeof("\033[0n"), 0);
> 
> This will write a NUL byte to the tty, which doesn't seem intentional.

Indeed, but it should not have any difference because '\0' is a control
character that in this situation is ignored by the terminal. Anyway it
should be avoided.

Regards,



Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-06 Thread Santtu Lakkala

On 6.2.2023 1.39, Adam Price wrote:

tsetattr(csiescseq.arg, csiescseq.narg);
break;
-   case 'n': /* DSR – Device Status Report (cursor position) */
-   if (csiescseq.arg[0] == 6) {
+   case 'n': /* DSR – Device Status Report */
+   switch (csiescseq.arg[0]) {
+   case 5: /* Status Report "OK" `0n` */
+   ttywrite("\033[0n", sizeof("\033[0n"), 0);


This will write a NUL byte to the tty, which doesn't seem intentional.


+   break;
+   case 6: /* Report Cursor Position (CPR) `;R` */
len = snprintf(buf, sizeof(buf), "\033[%i;%iR",
term.c.y+1, term.c.x+1);


--
Santtu