Open jawspeak opened 5 months ago
Worked around a bug which ideally can error if someone else uses it incorrectly as I did. Or at least the docs add this for inputField https://github.com/cronvel/terminal-kit/blob/master/doc/high-level.md#ref.inputField
This doesn't work
term.green.bold.inputField( //...
It fails ambiguously with
TypeError: Cannot read properties of undefined (reading 'removeListener') stacktrace: TypeError: Cannot read properties of undefined (reading 'removeListener') at notChainable.grabInput (/<workdir>/node_modules/terminal-kit/lib/Terminal.js:1341:13) at Terminal.inputField (/<workdir>/node_modules/terminal-kit/lib/inputField.js:151:32)
But this does work:
term.inputField( //...
The source is pretty clear in Terminal.js this is not chainable, but it would be nice to enforce that with an error or at least docs.
notChainable.grabInput = function( options , safe ) { // RESET this.mouseButton( false ) ; this.mouseDrag( false ) ; this.mouseMotion( false ) ; //this.mouseSGR( false ) ; this.focusEvent( false ) ; console.log('TEST grabInput() this.stdin', this.stdin); // this is not defined if chained term. this.stdin.removeListener( 'data' , this.onStdin ) ;
Worked around a bug which ideally can error if someone else uses it incorrectly as I did. Or at least the docs add this for inputField https://github.com/cronvel/terminal-kit/blob/master/doc/high-level.md#ref.inputField
This doesn't work
It fails ambiguously with
But this does work:
The source is pretty clear in Terminal.js this is not chainable, but it would be nice to enforce that with an error or at least docs.