Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can we make it work well with a relative layout? #2

Open
bencao opened this issue Jul 13, 2017 · 5 comments
Open

how can we make it work well with a relative layout? #2

bencao opened this issue Jul 13, 2017 · 5 comments

Comments

@bencao
Copy link

bencao commented Jul 13, 2017

Thanks for the good work! Recently I used blessed-xterm in my project, to draw a dashboard like following:

------------------------------------
==== Menu Items At Top ========
==== Terminal in the Middle ========
==== Status Bar At Bottom ======
------------------------------------

here're some information about the above layout:

menuLayout (top: 0, left: 0, height: 1)
terminalLayout (top: 1, left: 0, height: '100%-2')
   xTermWindow.width = terminalLayout.width
   xTermWindow.height = terminalLayout.height
statusBarLayout (bottom: 0, left: 0, height: 1)

The problem I noticed is that when I resize the terminal, or adjust font size, the xterm window will remain its initial size, which does not fit any more.

Any idea whether we can make it more "responsible" to layout changes?

Thank you!

@bencao
Copy link
Author

bencao commented Jul 13, 2017

I did a further attempt:

Instead of specify a fixed width, I passed on "parent" and a percentage as "width" and "height" to xTermWindow.
And I got an error like this:

TypeError: Cannot set property bytesRead of #<Socket> which has only a getter
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:16)
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:18)
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:18)
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:18)
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:18)
    at _clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:156:18)
    at clone (/Users/zcao/Documents/workspace/integration/node_modules/clone/clone.js:196:10)
    at XTerm (/Users/zcao/Documents/workspace/integration/node_modules/blessed-xterm/blessed-xterm.js5:54:19)
    at onBuildWorkspace (/Users/zcao/Documents/workspace/integration/cli/it_concerns/dev/uif.js:13:29)
    at buildScreen (/Users/zcao/Documents/workspace/integration/cli/it_concerns/dev/common.js:247:22)
    at buildWindows (/Users/zcao/Documents/workspace/integration/cli/it_concerns/dev/uif.js:10:10)
    at onReady (/Users/zcao/Documents/workspace/integration/cli/it_concerns/dev/uif.js:158:41)
    at Socket.runContainer.stdout.on.runContainerData (/Users/zcao/Documents/workspace/integration/cli/it_concerns/dev/common.js:440:7)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:250:12)

The reason might be that "parent" is a blessed layout object which cannot easily be cloned.

If I comment out the "clone" call in line 46 of blessed-xterm.js, it just works as expected, responsive to screen resize events and font size changes.

So the question becomes: What's the purpose of cloning the options, is it safe to remove this line?

@kamushadenes
Copy link

kamushadenes commented Feb 20, 2018

Had the same issue and commenting the clone call also fixed the problem for me.

I'm using the Grid layout from blessed-contrib.

@novast
Copy link

novast commented Oct 7, 2019

I have the same issue.
Comment the clone fix the problem.

@acidjazz
Copy link

Are any of you using a fork w/ this clone rmeoved @novast @kamushadenes @bencao ?

Is there a solution that doesn't require me to fork this @rse ?

@novast
Copy link

novast commented Nov 18, 2019

No. Finally, I found that blessed.log meet my requirement. @acidjazz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants