Coder Social home page Coder Social logo

Comments (3)

cronvel avatar cronvel commented on August 19, 2024

Hi,

This is not an issue related to a specific terminal, in fact .grabInput() change the terminal mode, so it send escape sequences containing data about the mouse button states. If nothing tell the terminal to
switch back to the normal mode, it will simply continue to work this way.

Typically, the code can be fixed using:

process.on( 'exit' , function() { term.grabInput( false ) ; process.exit() ; } ) ;
var term = require('terminal-kit').terminal
term.grabInput( { mouse: 'button', focus: true } ) 
term.on( 'mouse' , function( name , data ) {}) 
setTimeout( function() { throw new Error('dafuq') } , 1 )

It's hard to tell if this should be done in the lib or in the userland code, because there are more than one way of cleaning a terminal. For example, it is possible to alter the terminal color palette (if the terminal supports that feature), but does that mean that the lib should restore the palette before closing? One may want to create an utility that just edit the palette, and so on... (for example: application keypad mode).

Alternatively, you can type 'reset' in your shell to reset your terminal to its default behavior (so you don't have to close it and open a new window).

I labeled this issue as a 'discussion'.

from terminal-kit.

ashnur avatar ashnur commented on August 19, 2024

Some people might actually want the default behavior, and the behavior and the workaround is perfectly logical, however someone like me, who is a complete beginner with terminals, might get caught off guard. I think if this could be put in a visible place, that's a fine solution. It helps if even obvious things are mentioned somewhere :).

from terminal-kit.

cronvel avatar cronvel commented on August 19, 2024

Ok, I understand.

Since I can't imagine any use-case where one may want to leave its program with input grabbing on, I fixed it.

from terminal-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.