[BACK]Return to input.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/input.c between version 1.189 and 1.190

version 1.189, 2021/06/10 07:24:10 version 1.190, 2021/08/11 20:49:55
Line 77 
Line 77 
         struct window_pane     *wp;          struct window_pane     *wp;
         struct bufferevent     *event;          struct bufferevent     *event;
         struct screen_write_ctx ctx;          struct screen_write_ctx ctx;
           struct colour_palette  *palette;
   
         struct input_cell       cell;          struct input_cell       cell;
   
Line 797 
Line 798 
   
 /* Initialise input parser. */  /* Initialise input parser. */
 struct input_ctx *  struct input_ctx *
 input_init(struct window_pane *wp, struct bufferevent *bev)  input_init(struct window_pane *wp, struct bufferevent *bev,
       struct colour_palette *palette)
 {  {
         struct input_ctx        *ictx;          struct input_ctx        *ictx;
   
         ictx = xcalloc(1, sizeof *ictx);          ictx = xcalloc(1, sizeof *ictx);
         ictx->wp = wp;          ictx->wp = wp;
         ictx->event = bev;          ictx->event = bev;
           ictx->palette = palette;
   
         ictx->input_space = INPUT_BUF_START;          ictx->input_space = INPUT_BUF_START;
         ictx->input_buf = xmalloc(INPUT_BUF_START);          ictx->input_buf = xmalloc(INPUT_BUF_START);
Line 1252 
Line 1255 
 input_esc_dispatch(struct input_ctx *ictx)  input_esc_dispatch(struct input_ctx *ictx)
 {  {
         struct screen_write_ctx         *sctx = &ictx->ctx;          struct screen_write_ctx         *sctx = &ictx->ctx;
         struct window_pane              *wp = ictx->wp;  
         struct screen                   *s = sctx->s;          struct screen                   *s = sctx->s;
         struct input_table_entry        *entry;          struct input_table_entry        *entry;
   
Line 1269 
Line 1271 
   
         switch (entry->type) {          switch (entry->type) {
         case INPUT_ESC_RIS:          case INPUT_ESC_RIS:
                 if (wp != NULL)                  colour_palette_clear(ictx->palette);
                         window_pane_reset_palette(wp);  
                 input_reset_cell(ictx);                  input_reset_cell(ictx);
                 screen_write_reset(sctx);                  screen_write_reset(sctx);
                   screen_write_fullredraw(sctx);
                 break;                  break;
         case INPUT_ESC_IND:          case INPUT_ESC_IND:
                 screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);                  screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);
Line 1874 
Line 1876 
                         case 0:                          case 0:
                         case 2:                          case 2:
                                 screen_pop_title(sctx->s);                                  screen_pop_title(sctx->s);
                                 if (wp != NULL) {                                  if (wp == NULL)
                                         notify_pane("pane-title-changed", wp);                                          break;
                                         server_redraw_window_borders(wp->window);                                  notify_pane("pane-title-changed", wp);
                                         server_status_window(wp->window);                                  server_redraw_window_borders(wp->window);
                                 }                                  server_status_window(wp->window);
                                 break;                                  break;
                         }                          }
                         break;                          break;
Line 2498 
Line 2500 
 static void  static void
 input_osc_4(struct input_ctx *ictx, const char *p)  input_osc_4(struct input_ctx *ictx, const char *p)
 {  {
         struct window_pane      *wp = ictx->wp;          char    *copy, *s, *next = NULL;
         char                    *copy, *s, *next = NULL;          long     idx;
         long                     idx;          int      c, bad = 0, redraw = 0;
         int                      c;  
   
         if (wp == NULL)  
                 return;  
   
         copy = s = xstrdup(p);          copy = s = xstrdup(p);
         while (s != NULL && *s != '\0') {          while (s != NULL && *s != '\0') {
                 idx = strtol(s, &next, 10);                  idx = strtol(s, &next, 10);
                 if (*next++ != ';')                  if (*next++ != ';') {
                         goto bad;                          bad = 1;
                 if (idx < 0 || idx >= 0x100)                          break;
                         goto bad;                  }
                   if (idx < 0 || idx >= 256) {
                           bad = 1;
                           break;
                   }
   
                 s = strsep(&next, ";");                  s = strsep(&next, ";");
                 if ((c = input_osc_parse_colour(s)) == -1) {                  if ((c = input_osc_parse_colour(s)) == -1) {
                         s = next;                          s = next;
                         continue;                          continue;
                 }                  }
                   if (colour_palette_set(ictx->palette, idx, c))
                 window_pane_set_palette(wp, idx, c);                          redraw = 1;
                 s = next;                  s = next;
         }          }
           if (bad)
                   log_debug("bad OSC 4: %s", p);
           if (redraw)
                   screen_write_fullredraw(&ictx->ctx);
         free(copy);          free(copy);
         return;  
   
 bad:  
         log_debug("bad OSC 4: %s", p);  
         free(copy);  
 }  }
   
 /* Handle the OSC 10 sequence for setting and querying foreground colour. */  /* Handle the OSC 10 sequence for setting and querying foreground colour. */
Line 2540 
Line 2540 
         struct grid_cell         defaults;          struct grid_cell         defaults;
         int                      c;          int                      c;
   
         if (wp == NULL)  
                 return;  
   
         if (strcmp(p, "?") == 0) {          if (strcmp(p, "?") == 0) {
                 tty_default_colours(&defaults, wp);                  if (wp != NULL) {
                 input_osc_colour_reply(ictx, 10, defaults.fg);                          tty_default_colours(&defaults, wp);
                           input_osc_colour_reply(ictx, 10, defaults.fg);
                   }
                 return;                  return;
         }          }
   
         if ((c = input_osc_parse_colour(p)) == -1)          if ((c = input_osc_parse_colour(p)) == -1) {
                 goto bad;                  log_debug("bad OSC 10: %s", p);
         wp->fg = c;                  return;
         wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);          }
           ictx->palette->fg = c;
         return;          if (wp != NULL)
                   wp->flags |= PANE_STYLECHANGED;
 bad:          screen_write_fullredraw(&ictx->ctx);
         log_debug("bad OSC 10: %s", p);  
 }  }
   
 /* Handle the OSC 110 sequence for resetting background colour. */  /* Handle the OSC 110 sequence for resetting background colour. */
Line 2566 
Line 2564 
 {  {
         struct window_pane      *wp = ictx->wp;          struct window_pane      *wp = ictx->wp;
   
         if (wp == NULL)  
                 return;  
   
         if (*p != '\0')          if (*p != '\0')
                 return;                  return;
           ictx->palette->fg = 8;
         wp->fg = 8;          if (wp != NULL)
         wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);                  wp->flags |= PANE_STYLECHANGED;
           screen_write_fullredraw(&ictx->ctx);
 }  }
   
 /* Handle the OSC 11 sequence for setting and querying background colour. */  /* Handle the OSC 11 sequence for setting and querying background colour. */
Line 2584 
Line 2580 
         struct grid_cell         defaults;          struct grid_cell         defaults;
         int                      c;          int                      c;
   
         if (wp == NULL)  
                 return;  
   
         if (strcmp(p, "?") == 0) {          if (strcmp(p, "?") == 0) {
                 tty_default_colours(&defaults, wp);                  if (wp != NULL) {
                 input_osc_colour_reply(ictx, 11, defaults.bg);                          tty_default_colours(&defaults, wp);
                           input_osc_colour_reply(ictx, 11, defaults.bg);
                   }
                 return;                  return;
         }          }
   
         if ((c = input_osc_parse_colour(p)) == -1)          if ((c = input_osc_parse_colour(p)) == -1) {
                 goto bad;                  log_debug("bad OSC 11: %s", p);
         wp->bg = c;                  return;
         wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);          }
           ictx->palette->bg = c;
         return;          if (wp != NULL)
                   wp->flags |= PANE_STYLECHANGED;
 bad:          screen_write_fullredraw(&ictx->ctx);
         log_debug("bad OSC 11: %s", p);  
 }  }
   
 /* Handle the OSC 111 sequence for resetting background colour. */  /* Handle the OSC 111 sequence for resetting background colour. */
Line 2610 
Line 2604 
 {  {
         struct window_pane      *wp = ictx->wp;          struct window_pane      *wp = ictx->wp;
   
         if (wp == NULL)  
                 return;  
   
         if (*p != '\0')          if (*p != '\0')
                 return;                  return;
           ictx->palette->bg = 8;
         wp->bg = 8;          if (wp != NULL)
         wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);                  wp->flags |= PANE_STYLECHANGED;
           screen_write_fullredraw(&ictx->ctx);
 }  }
   
 /* Handle the OSC 52 sequence for setting the clipboard. */  /* Handle the OSC 52 sequence for setting the clipboard. */
Line 2692 
Line 2684 
 static void  static void
 input_osc_104(struct input_ctx *ictx, const char *p)  input_osc_104(struct input_ctx *ictx, const char *p)
 {  {
         struct window_pane      *wp = ictx->wp;          char    *copy, *s;
         char                    *copy, *s;          long     idx;
         long                     idx;          int      bad = 0, redraw = 0;
   
         if (wp == NULL)  
                 return;  
   
         if (*p == '\0') {          if (*p == '\0') {
                 window_pane_reset_palette(wp);                  colour_palette_clear(ictx->palette);
                   screen_write_fullredraw(&ictx->ctx);
                 return;                  return;
         }          }
   
         copy = s = xstrdup(p);          copy = s = xstrdup(p);
         while (*s != '\0') {          while (*s != '\0') {
                 idx = strtol(s, &s, 10);                  idx = strtol(s, &s, 10);
                 if (*s != '\0' && *s != ';')                  if (*s != '\0' && *s != ';') {
                         goto bad;                          bad = 1;
                 if (idx < 0 || idx >= 0x100)                          break;
                         goto bad;                  }
                   if (idx < 0 || idx >= 256) {
                 window_pane_unset_palette(wp, idx);                          bad = 1;
                           break;
                   }
                   if (colour_palette_set(ictx->palette, idx, -1))
                           redraw = 1;
                 if (*s == ';')                  if (*s == ';')
                         s++;                          s++;
         }          }
         free(copy);          if (bad)
         return;                  log_debug("bad OSC 104: %s", p);
           if (redraw)
 bad:                  screen_write_fullredraw(&ictx->ctx);
         log_debug("bad OSC 104: %s", p);  
         free(copy);          free(copy);
 }  }

Legend:
Removed from v.1.189  
changed lines
  Added in v.1.190