--- teseq-1.1.1/src/teseq.c.bak	2015-08-14 02:59:19.000000000 +0200
+++ teseq-1.1.1/src/teseq.c	2019-08-18 00:31:01.108881301 +0200
@@ -1177,12 +1177,12 @@
   currently supported by Teseq.
   
   If CSI (Esc [) is invoked, further processing is done to determine if
-  there is a valid control sequence.
+  there is a valid control sequence.  Likewise for OSC (Esc ]).
 */
 int
 handle_c1 (struct processor *p, unsigned char c)
 {
-  if (c == '[')
+  if (c == '[') /* CSI */
     {
       const struct csi_handler *h;
       if ((h = read_csi_sequence (p)))
@@ -1196,6 +1196,166 @@
           inputbuf_get (p->ibuf);       /* Throw away '[' */
         }
     }
+  else if (c == ']') /* OSC */
+    {
+      size_t bytes_parsed = 1;
+      int pc = inputbuf_get (p->ibuf);
+
+      if (pc == '0')
+        {
+          bytes_parsed++;
+          pc = inputbuf_get (p->ibuf);
+          if (pc == ';')
+            {
+              size_t bytes_before_title;
+              char *title;
+
+              bytes_parsed++;
+              bytes_before_title = bytes_parsed;
+              do
+                {
+                  pc = inputbuf_get (p->ibuf);
+                  bytes_parsed += (pc != EOF);
+                }
+              while (!(pc == EOF || pc == C_ESC || pc == '\007'));
+
+              inputbuf_rewind (p->ibuf);
+
+              title = malloc (bytes_parsed - bytes_before_title + 1);
+              {
+                char *t = title;
+                size_t i;
+                for (i = 0; i < bytes_before_title; i++)
+                  inputbuf_get (p->ibuf);
+                for (; i < bytes_parsed; i++)
+                  *t++ = inputbuf_get (p->ibuf);
+                *t = '\0';
+              }
+              if (configuration.escapes)
+                putter_single_esc (p->putr, "Esc ] 0 ; %s", title);
+              if (configuration.labels)
+                print_c1_label (p, c);
+              putter_single_desc (p->putr, "Set window and icon title to |%s|", title);
+              free (title);
+
+              inputbuf_reset_count (p->ibuf);
+              return 1;
+            }
+        }
+      else if (pc == '2')
+        {
+          bytes_parsed++;
+          pc = inputbuf_get (p->ibuf);
+          if (pc == ';')
+            {
+              size_t bytes_before_title;
+              char *title;
+
+              bytes_parsed++;
+              bytes_before_title = bytes_parsed;
+              do
+                {
+                  pc = inputbuf_get (p->ibuf);
+                  bytes_parsed += (pc != EOF);
+                }
+              while (!(pc == EOF || pc == C_ESC || pc == '\007'));
+
+              inputbuf_rewind (p->ibuf);
+
+              title = malloc (bytes_parsed - bytes_before_title + 1);
+              {
+                char *titlep = title;
+                size_t i;
+                for (i = 0; i < bytes_before_title; i++)
+                  inputbuf_get (p->ibuf);
+                for (; i < bytes_parsed; i++)
+                  *titlep++ = inputbuf_get (p->ibuf);
+                *titlep = '\0';
+              }
+              if (configuration.escapes)
+                putter_single_esc (p->putr, "Esc ] 2 ; %s", title);
+              if (configuration.labels)
+                print_c1_label (p, c);
+              putter_single_desc (p->putr, "Set window title to |%s|", title);
+              free (title);
+
+              inputbuf_reset_count (p->ibuf);
+              return 1;
+            }
+        }
+      else if (pc == '8')
+        {
+          bytes_parsed++;
+          pc = inputbuf_get (p->ibuf);
+          if (pc == ';')
+            {
+              size_t bytes_before_params;
+              size_t bytes_after_params;
+
+              bytes_parsed++;
+              bytes_before_params = bytes_parsed;
+              do
+                {
+                  pc = inputbuf_get (p->ibuf);
+                  bytes_parsed += (pc != EOF);
+                }
+              while (!(pc == EOF || pc == ';' || pc == C_ESC || pc == '\007'));
+              bytes_after_params = bytes_parsed - (pc != EOF);
+              if (pc == ';')
+                {
+                  size_t bytes_before_url;
+                  size_t bytes_after_url;
+                  char *params;
+                  char *url;
+
+                  bytes_before_url = bytes_parsed;
+                  do
+                    {
+                      pc = inputbuf_get (p->ibuf);
+                      bytes_parsed += (pc != EOF);
+                    }
+                  while (!(pc == EOF || pc == ';' || pc == C_ESC || pc == '\007'));
+                  bytes_after_url = bytes_parsed - (pc != EOF);
+
+                  inputbuf_rewind (p->ibuf);
+
+                  params = malloc (bytes_after_params - bytes_before_params + 1);
+                  url = malloc (bytes_after_url - bytes_before_url + 1);
+                  {
+                    char *paramsp = params;
+                    char *urlp = url;
+                    size_t i;
+                    for (i = 0; i < bytes_before_params; i++)
+                      inputbuf_get (p->ibuf);
+                    for (; i < bytes_after_params; i++)
+                      *paramsp++ = inputbuf_get (p->ibuf);
+                    *paramsp = '\0';
+                    for (; i < bytes_before_url; i++)
+                      inputbuf_get (p->ibuf);
+                    for (; i < bytes_after_url; i++)
+                      *urlp++ = inputbuf_get (p->ibuf);
+                    *urlp = '\0';
+                  }
+                  if (configuration.escapes)
+                    putter_single_esc (p->putr, "Esc ] 8 ; %s ; %s", params, url);
+                  if (configuration.labels)
+                    print_c1_label (p, c);
+                  if (*params != '\0')
+                    putter_single_desc (p->putr, "Set hyperlink to |%s| with params %s", url, params);
+                  else
+                    putter_single_desc (p->putr, "Set hyperlink to |%s|", url);
+                  free (url);
+                  free (params);
+
+                  inputbuf_reset_count (p->ibuf);
+                  return 1;
+                }
+            }
+        }
+
+      inputbuf_rewind (p->ibuf);
+      inputbuf_get (p->ibuf);       /* Throw away ']' */
+    }
 
   if (configuration.escapes)
     putter_single_esc (p->putr, "Esc %c", c);
