HTTP/2 302
date: Sat, 26 Jul 2025 16:20:58 GMT
content-type: text/html; charset=utf-8
content-length: 0
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
location: https://gist.github.com/TooTallNate/1702813
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
set-cookie: _gh_sess=umF%2Bd0V9JCPi2aGzBID96oTqXjJNzoJ3haSkUXwwftuqgqwItNnSJOx7iIVvTYKsACZfl7QzWX8TK6WsEOcsiq8vdMdvD8RTEy5yYw4BKD9dSwsexHpNGEeGe9wdwoAhZ5qsQXoAVGb1tLNQ5%2BU9J%2F97bSFJaGEfRoKwoFFfF57zxD%2FYoYKzm%2FdT3E8g3tCoznHoMo70bis6v6HD5WzL0qvobgxXoYm2swaABdxFPtB4g1SfwsTvAOamWffHPz5JXgBjmaiEXhwFd%2BQn%2Fu4bdA%3D%3D--G%2BjSxM8ECTMvAqel--4iXbBH1lelChZwBJe%2BCrng%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1188818768.1753546858; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 16:20:58 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 16:20:58 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: B2A6:178C3F:730B4C:9483E3:6885006A
HTTP/2 200
date: Sat, 26 Jul 2025 16:20:59 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"74bcb63e4d3f705f77598a08694b7390"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
x-github-request-id: B2A6:178C3F:730B8C:94843F:6885006A
Enable "mouse reporting" with Node.js · GitHub
Instantly share code, notes, and snippets.
Created
January 30, 2012 05:55
Star
15
(15 )
You must be signed in to star a gist
Fork
1
(1 )
You must be signed in to fork a gist
Save TooTallNate/1702813 to your computer and use it in GitHub Desktop.
Save TooTallNate/1702813 to your computer and use it in GitHub Desktop.
Enable "mouse reporting" with Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on:
// https://groups.google.com/group/nodejs-dev/browse_thread/thread/a0c23008029e5fa7
process . stdin . resume ( ) ;
process . stdin . on ( 'data' , function ( b ) {
var s = b . toString ( 'utf8' ) ;
if ( s === '\u0003' ) {
console . error ( 'Ctrl+C' ) ;
process . stdin . pause ( ) ;
} else if ( / ^ \u001b \[ M / . test ( s ) ) {
// mouse event
console . error ( 's.length:' , s . length ) ;
// reuse the key array albeit its name
// otherwise recompute as the mouse event is structured differently
var modifier = s . charCodeAt ( 3 ) ;
var key = { } ;
key . shift = ! ! ( modifier & 4 ) ;
key . meta = ! ! ( modifier & 8 ) ;
key . ctrl = ! ! ( modifier & 16 ) ;
key . x = s . charCodeAt ( 4 ) - 32 ;
key . y = s . charCodeAt ( 5 ) - 32 ;
key . button = null ;
key . sequence = s ;
key . buf = Buffer ( key . sequence ) ;
if ( ( modifier & 96 ) === 96 ) {
key . name = 'scroll' ;
key . button = modifier & 1 ? 'down' : 'up' ;
} else {
key . name = modifier & 64 ? 'move' : 'click' ;
switch ( modifier & 3 ) {
case 0 : key . button = 'left' ; break ;
case 1 : key . button = 'middle' ; break ;
case 2 : key . button = 'right' ; break ;
case 3 : key . button = 'none' ; break ;
default : return ;
}
}
console . error ( key ) ;
} else {
// something else...
console . error ( 0 , s , b ) ;
}
} )
// Enable "raw mode"
if ( process . stdin . setRawMode ) {
process . stdin . setRawMode ( true ) ;
} else {
require ( 'tty' ) . setRawMode ( true ) ;
}
// Enable "mouse reporting"
process . stdout . write ( '\x1b[?1005h' ) ;
process . stdout . write ( '\x1b[?1003h' ) ;
process . on ( 'exit' , function ( ) {
// don't forget to turn off mouse reporting
process . stdout . write ( '\x1b[?1005l' ) ;
process . stdout . write ( '\x1b[?1003l' ) ;
} ) ;
You can’t perform that action at this time.
Thank you! This helped me a lot in a Project!