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

Use shift() when reducing lines to preserve lines up to cursor #50

Merged
merged 1 commit into from
Apr 20, 2016

Conversation

blink1073
Copy link
Contributor

The previous behavior of a resize to a smaller height kept the start of the buffer and tacked on a prompt line. This fix allows the text up to the existing prompt to be preserved.

@blink1073 blink1073 changed the title Use shift to reduce lines to preserve lines up to cursor Use shift() when reducing lines to preserve lines up to cursor Apr 14, 2016
@parisk
Copy link
Contributor

parisk commented Apr 14, 2016

Hi @blink1073, thanks for opening this.

Attempted to try this and I fell into the following issue, which was not present before:

  1. created an empty xterm front-end
  2. created a Docker container with a bash shell that has a multi-line bash prompt
  3. attached the xterm front-end to the docker container through a websocket
  4. resized the back-end pty to match the size of the front-end visual element
  5. the whole multi-line bash prompt disappeared

Could you please try a similar case in jupyter-js-ui to see if this happens there as well?

@blink1073
Copy link
Contributor Author

Hi @parisk, I don't have the infrastructure set up to use xterm at the moment. We have been using term.js in Jupyter and I hand-modified these lines in node_modules to verify that it worked.

@parisk
Copy link
Contributor

parisk commented Apr 15, 2016

Okay @blink1073. Please let me make a couple of tests more, to see where the bug is and I will get back to you within the next hours most probably.

@blink1073
Copy link
Contributor Author

blink1073 commented Apr 15, 2016

I was able to swap in xterm for term.js in my application and verify that this fix works.

@parisk
Copy link
Contributor

parisk commented Apr 18, 2016

Thanks @blink1073 for letting me know. I still got the issue faced. Please let me do some more tests, to find out what might be going wrong. Seems quite strange.

@parisk
Copy link
Contributor

parisk commented Apr 18, 2016

Do you have any public branch of your application that I could clone to test out myself, in order to find out if something goes wrong with my system?

@blink1073
Copy link
Contributor Author

This setup requires Python installed with the Jupyter Notebook. The easiest way to get there is using Anaconda: https://www.continuum.io/downloads

git clone https://github.com/blink1073/jupyter-js-ui
cd jupyter-js-ui
git checkout xterm
npm install
npm run build
npm run build:examples
cd examples
# edit node_modules/xterm/src/xterm.js
cd terminal
npm run build
python main.py

I've been running history and then resizing the window vertically to verify.

@parisk
Copy link
Contributor

parisk commented Apr 20, 2016

@blink1073 I followed your instructions step-by-step and the iPython notebook does not seem to use xterm.js as its terminal.

Could you please point out if am I doing something wrong and how to fix it? Providing logs and screenshots below in order to be as helpful as possible.

Note
The file examples/terminal/build/bundle.js includes Xterm in it. It just seems that examples/terminal never loads for some reason.

Software versions

  • Python: 2.7.9
  • Jupyter: 1.0.0
  • notebook: 4.2.0
  • Node: 0.10.35
  • npm: 2.1.16

Terminal logs

[D 11:59:00.925 NotebookApp] Config changed:
[D 11:59:00.926 NotebookApp] {'NotebookApp': {'allow_origin': 'http://localhost:8765', 'open_browser': False, 'log_level': 10}}
[D 11:59:00.926 NotebookApp] Searching [u'/Users/paris/Desktop/jupyter-js-ui/examples/terminal', '/Users/paris/.jupyter', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[D 11:59:00.926 NotebookApp] Attempting to load config file jupyter_config.py in path /etc/jupyter
[D 11:59:00.926 NotebookApp] Attempting to load config file jupyter_config.json in path /etc/jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.py in path /usr/local/etc/jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.json in path /usr/local/etc/jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.py in path /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/etc/jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.json in path /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/etc/jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.py in path /Users/paris/.jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.json in path /Users/paris/.jupyter
[D 11:59:00.927 NotebookApp] Attempting to load config file jupyter_config.py in path /Users/paris/Desktop/jupyter-js-ui/examples/terminal
[D 11:59:00.928 NotebookApp] Attempting to load config file jupyter_config.json in path /Users/paris/Desktop/jupyter-js-ui/examples/terminal
[D 11:59:00.928 NotebookApp] Attempting to load config file jupyter_notebook_config.py in path /etc/jupyter
[D 11:59:00.928 NotebookApp] Attempting to load config file jupyter_notebook_config.json in path /etc/jupyter
[D 11:59:00.928 NotebookApp] Attempting to load config file jupyter_notebook_config.py in path /usr/local/etc/jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.json in path /usr/local/etc/jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.py in path /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/etc/jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.json in path /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/etc/jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.py in path /Users/paris/.jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.json in path /Users/paris/.jupyter
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.py in path /Users/paris/Desktop/jupyter-js-ui/examples/terminal
[D 11:59:00.929 NotebookApp] Attempting to load config file jupyter_notebook_config.json in path /Users/paris/Desktop/jupyter-js-ui/examples/terminal
[D 11:59:00.992 NotebookApp] Native kernel (python2) available from /usr/local/lib/python2.7/site-packages/ipykernel/resources
[I 11:59:01.003 NotebookApp] Serving notebooks from local directory: /Users/paris/Desktop/jupyter-js-ui/examples/terminal
[I 11:59:01.003 NotebookApp] 0 active kernels
[I 11:59:01.003 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 11:59:01.003 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Screenshots

Occupied ports (nothing listens on 8765)

image

Non-accessible at localhost:8765

image

Notebook home page

image

Terminal is not xterm.js

image

@parisk
Copy link
Contributor

parisk commented Apr 20, 2016

@blink1073 nevermind. Got it working. On the issue right now

@parisk
Copy link
Contributor

parisk commented Apr 20, 2016

Everything seems to be working great 😊 .

Thanks for your contribution!

@parisk parisk merged commit ad3764a into xtermjs:master Apr 20, 2016
@blink1073
Copy link
Contributor Author

Sweet, my pleasure.

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

Successfully merging this pull request may close these issues.

None yet

2 participants