lib/terminal.js
function encode(data, ch) {
        if (!self.utfMouse) {
          if (ch === 255) return data.push(0);
          if (ch > 127) ch = 127;
          data.push(ch);
        } else {
          if (ch === 2047) return data.push(0);
          if (ch < 127) {
            data.push(ch);
          } else {
            if (ch > 2047) ch = 2047;
            data.push(0xC0 | (ch >> 6));
            data.push(0x80 | (ch & 0x3F));
          }
        }
      }
function encode(data, ch) {
        if (!self.utfMouse) {
          if (ch === 255) return data.push(0);
          if (ch > 127) ch = 127;
          data.push(ch);
        } else {
          if (ch === 2047) return data.push(0);
          if (ch < 127) {
            data.push(ch);
          } else {
            if (ch > 2047) ch = 2047;
            data.push(0xC0 | (ch >> 6));
            data.push(0x80 | (ch & 0x3F));
          }
        }
      }
function encode ( data , ch ) { if ( ! self . utfMouse ) { if ( ch === 255 ) return data . push ( 0 ) ; if ( ch > 127 ) ch = 127 ; data . push ( ch ) ; } else { if ( ch === 2047 ) return data . push ( 0 ) ; if ( ch < 127 ) { data . push ( ch ) ; } else { if ( ch > 2047 ) ch = 2047 ; data . push ( 0xC0 | ( ch >> 6 ) ) ; data . push ( 0x80 | ( ch & 0x3F ) ) ; } } }
encode button and position to characters
encode button and position to characters