Comments (10)
@b4dnewz Hmm... I don't see any error on my side... Can you post your code?
from terminal-kit.
yep sure @cronvel , the module is a fork of a module that isn't working anymore and i'm trying to fix by replacing it's internal functions with your module entirely (if possible).
I set the key bindings (for a particular screen) in this lines.
binding func and on event
this bindings catch 'b', 'p' and some other letters, than in a different "mode" or screen I take a input from the user so I call the off function but when I try to type something is still listening for 'b', 'p', etc..
So to resume quickly, in the main mode b
(and other keys) are bound to actions, when I press b
to change mode I unset the previous mode key bindings since it needs to take an input and every time I press b
ti trigger the action function (that change screen) instead of catching b as input.
PS: the forked module is still under heavy development and refactoring so it's not working properly but that part is working right now.
from terminal-kit.
@b4dnewz You are using .bind()
to register the listener and the real function to stop listening:
this.term.on('key', this.listModeKeys.bind(this))
this.term.off('key', this.listModeKeys)
A Javascript function is not equal to its bounded version, that's why it doesn't work. ;)
from terminal-kit.
so I need to bind the context to the other funtion too? right?
edit: also, do you have a removeAll
method or something like this?
edit2: I've tried to add .bind(this)
to the off call but still not working
from terminal-kit.
@b4dnewz No it would be two different bound functions again.
There are many solutions. One of them is to tranform Monitor.prototype.listModeKeys = function(key, matches, data)
to a regular function listModeKeys(key, matches, data)
, and inside the Monitor()
constructor assign this.listModeKeys = listModeKeys.bind( this )
.
from terminal-kit.
thanks for the clarification @cronvel.
I will try to refactor my code.
from terminal-kit.
hey @cronvel do you use slack or any other chat? I would like if possible in some rare cases where the documentation (which is great) doesn't help me, to talk with you directly, is that possible?
many thanks in advance, I fixes it, right now I'm focused to make my fork version work exactly the same like previous but using your module, than I will refactor all the code and the logic.
from terminal-kit.
hi @cronvel, it's again me, I don't want to be boring and I don't want to open any other issue since are questions most of my troubles.
I'm trying to get the stdin and stdout from a socket client using node net
module to create a server since node-telnet it's not updated, relies on node-buffers which it's not working.
I've spent a lot of hours right now trying to figure out how to pass the stdin and stdout to terminal-kit, right now I found only this example on stack overflow but it's not helping too much.
from the stack-overflow example re-adapted
var connect = require('net');
var client = connect.connect('80', 'localhost');
client.on('data', function(data) {
process.stdin.once('data', function (chunk) {
term(chunk.toString())
});
})
Do you know if is possible? I've looked deep into the net documentation but without success..
Edit: The best thing I found until now it this answer but I can't figure out how to use this .pipe()
method..and right now I must sleep :D
Many thanks in advance and sorry again for for all the trouble.
from terminal-kit.
@b4dnewz Hi, you should use the terminal constructor.
This should work:
var termkit = require( 'terminal-kit' ) ;
var term = termkit.createTerminal( {
stdin: yourSocket ,
stdout: yourSocket ,
stderr: yourSocket
} ) ;
After that, start using terminal-kit as usual.
BTW terminal-kit cannot detect the terminal correctly, and default to xterm-compatible.
If you know your terminal, you can set the appId option, which should match file's basenames found in the lib/termconfig/ directory of the lib.
from terminal-kit.
thanks @cronvel it's working good now!
on certain terminal less than on others but maybe it depends on my code, I will do further checks
from terminal-kit.
Related Issues (20)
- terminalkit.TextBox is not a constructor HOT 3
- document: InlineInputField only widthPercent breaks input
- Redraw window every "frame" HOT 1
- Word/Line wrap ERROR when x,y,width or height of TextBox are non integers
- Unable to draw the correct image in vscode dark-mode terminal!
- Can't run after packed with pkg HOT 3
- Cannot input after using term.inputField() HOT 4
- Issue: Terminal stuck in while-loop when initating another terminal with stdin/stdout
- Form control event and validation
- form render issue - hide/show control
- Erase Everything - How?
- Possible EventEmitter memory leak
- Multiple Documents in Same Terminal Screen
- support for fonts
- term.table does not work in Azure pipeline HOT 6
- term.table does not work in Azure pipeline HOT 1
- Unable to bundle code with dependencies HOT 5
- inputField Inline support? HOT 1
- Documentation request: cannot chain .inputField
- Unable to add left padding to singleLineMenu?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminal-kit.