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

fix: fix terminal resize when hidden #136

Merged
merged 4 commits into from
Aug 5, 2020
Merged

fix: fix terminal resize when hidden #136

merged 4 commits into from
Aug 5, 2020

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Aug 3, 2020

fixes #135

@UziTech
Copy link
Member Author

UziTech commented Aug 3, 2020

This might also fix #57

@UziTech UziTech mentioned this pull request Aug 3, 2020
@aminya
Copy link
Contributor

aminya commented Aug 3, 2020

I am testing this. I will see if that error happens again!

@aminya
Copy link
Contributor

aminya commented Aug 5, 2020

I again got the error:

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.49.0 x64
Electron: 5.0.13
OS: Microsoft Windows 10 Enterprise
Thrown From: x-terminal package 9.0.3

Stack Trace

Uncaught Error: This API only accepts integers

At C:\Users\yahyaaba\Documents\GitHub\JavaScript\x-terminal\node_modules\xterm\lib\xterm.js:1

Error: This API only accepts integers
    at e._verifyIntegers (~/Documents/GitHub/JavaScript/x-terminal/node_modules/xterm/lib/xterm.js:1:101386)
    at e.resize (~/Documents/GitHub/JavaScript/x-terminal/node_modules/xterm/lib/xterm.js:1:98497)
    at e.fit (~/Documents/GitHub/JavaScript/x-terminal/node_modules/xterm-addon-fit/lib/xterm-addon-fit.js:1:1723)
    at HTMLElement.refitTerminal (~/Documents/GitHub/JavaScript/x-terminal/src/element.js:688:18)
    at HTMLElement.applyPendingTerminalProfileOptions (~/Documents/GitHub/JavaScript/x-terminal/src/element.js:670:9)
    at IntersectionObserver.terminalDivIntersectionObserver.IntersectionObserver.root (~/Documents/GitHub/JavaScript/x-terminal/src/element.js:109:11)

Commands

     -0:42.7.0 core:paste (input.hidden-input)
     -0:42.2.0 core:save (input.hidden-input)
     -0:34.1.0 tree-view:remove-project-folder (span.name.icon.icon-repo)
  6x -0:28.4.0 core:delete (input.hidden-input)
     -0:26.1.0 core:save (input.hidden-input)
     -0:22.3.0 core:backspace (input.hidden-input)
     -0:21.8.0 core:save (input.hidden-input)
     -0:21.2.0 core:backspace (input.hidden-input)
     -0:21 core:save (input.hidden-input)
     -0:19.5.0 core:backspace (input.hidden-input)
     -0:19.2.0 core:save (input.hidden-input)
  3x -0:17.3.0 core:backspace (input.hidden-input)
     -0:16.6.0 core:save (input.hidden-input)
     -0:12.8.0 command-palette:toggle (input.hidden-input)
     -0:11.9.0 core:confirm (input.hidden-input)
     -0:11.9.0 x-terminal:open (input.hidden-input)

Non-Core Packages

ascii-hex 0.2.0 
atom-alignment 0.13.0 
atom-bash 1.1.1 
atom-beautify 0.33.4 
atom-commander 0.12.0 
atom-console 0.4.6 
atom-ide-base 1.1.1 
atom-ide-datatip 0.13.2 
atom-ide-definitions 0.3.6 
atom-ide-hyperclick 1.0.3 
atom-ide-javascript 1.2.1 
atom-ide-julia 0.1.0 
atom-ide-markdown-service 1.3.1 
atom-ide-outline 1.9.4 
atom-ide-signature-help 0.8.0 
atom-ide-template-rust 0.1.0 
atom-ide-ui 0.13.0 
indent-detective 0.4.0 
atom-material-ui 2.1.3 
atom-matlab-editor 0.4.0 
atom-minify 0.8.0 
atom-reverser 3.0.4 
atom-terminal 0.8.0 
atom-typescript 13.9.2 
atomic-management 0.3.1 
atomizr 0.23.2 
auto-fold 0.4.0 
autocomplete 0.47.0 
autocomplete-bash-builtins 0.3.5 
autocomplete-clang 0.13.1 
autocomplete-en-en 0.2.0 
autocomplete-paths 2.12.2 
build 0.70.0 
build-npm-apm 0.12.0 
busy-signal 2.0.1 
clean-context-menu 0.3.2 
colorful-json 1.1.0 
cson-parser 0.1.0 
ctags-status 1.4.0 
file-icons 2.1.42 
find-trailing-whitespace 0.1.0 
fold-functions 0.11.0 
fold-lines 0.2.2 
font-viewer 0.4.0 
glow undefined 
hello_world-webpack 0.1.0 
hey-pane undefined 
highlight-selected 0.17.0 
Hydrogen 2.14.4 
hyperclick 0.1.5 
ide-bash 1.0.11 
ide-c-cpp 0.1.0 
ide-clangd 0.4.0 
ide-css 0.3.4 
ide-json 0.2.1 
ide-powershell 0.1.0 
ide-python 1.5.0 
ide-typescript 0.9.1 
ide-yaml 0.7.0 
ide-yml 0.7.8-0 
intentions 1.1.5 
javascript-drag-import 0.1.13 
javascript-refactor 0.7.1 
json-converter 0.2.4 
juno-plus 0.12.2 
keyword-pair-matcher 0.2.1 
kite 0.185.0 
language-autohotkey2 1.0.1 
language-cmake 1.2.0 
language-github-actions 0.1.0 
language-julia 0.19.3 
language-latex 1.2.0 
language-matlab 0.2.1 
language-matlab-octave 1.0.5 
language-matlab-plus 1.12.0 
language-pfm 0.82.0 
language-powershell 5.0.0 
language-reg 0.0.0 
latex-autocomplete 1.1.1 
latex-completions 0.3.6 
latex-friend 0.0.11 
latex-image-paste 0.5.0 
latex-itemizer 1.1.1 
latex-tree 0.5.0 
latex-wordcount 0.6.0 
less-than-slash 0.19.0 
linter 2.3.1 
linter-clang 4.1.2 
linter-cpplint 2.1.0 
linter-eslint 8.5.5 
linter-gcc 0.9.0 
linter-gcc2 0.8.8 
linter-julia 0.8.3 
linter-matlab 1.3.0 
linter-shellcheck 1.6.0 
linter-spell 0.15.0 
linter-spell-javascript 0.9.0 
linter-spell-latex 0.11.0 
linter-tslint 1.10.43 
linter-ui-default 1.8.1 
markdown-preview-plus 4.5.0 
markdown-preview-plus-opener 0.4.0 
markdown-writer 2.11.10 
menu-manager 0.6.0 
minimap-find-and-replace 4.5.2 
minimap-highlight-selected 4.6.1 
minimap-lens 0.7.0 
minimap-linter 2.2.1 
minimap-plus 4.32.0 
minimap-titles 1.15.0 
multi-copy 0.1.0 
multi-cursor-plus 1.2.0 
multi-line-editor 1.6.0 
multi-paste2 0.4.1 
package-ts-generator 0.1.2 
pdf-view 0.72.0 
preview 0.19.0 
preview-inline 1.5.1 
project-manager 3.3.8 
Quick-JavaScript 2.2.0 
script 3.26.0 
snippet-generator-plus 0.1.2 
snippets-plus 0.10.2 
split-diff 1.6.1 
string-encoder 0.2.0 
Sublime-Style-Column-Selection 1.7.5 
symbols-tree-nav 0.15.5 
sync-settings 4.3.8 
teletype 0.13.4 
tool-bar 1.3.0 
trailing-spaces 0.4.0 
tree-view-git-status 1.5.3 
turbo-javascript 1.4.0 
uber-juno 0.3.0 
vim-mode-plus 1.36.4 
web-view 3.0.0 
x-terminal 9.0.3 

@UziTech
Copy link
Member Author

UziTech commented Aug 5, 2020

@aminya what were you doing with x-terminal when you got the error?

@aminya
Copy link
Contributor

aminya commented Aug 5, 2020

@aminya what were you doing with x-terminal when you got the error?

I just ran x-terminal open. This error happens only when you try to open a terminal! I use the bottom dock for my terminal's position.

@UziTech
Copy link
Member Author

UziTech commented Aug 5, 2020

I was able to recreate it. It seems that if xterm is initialized with a hidden div than it gives itself a 0px height and fails to resize. I'm thinking this is a bug in xterm but I'm not exactly sure where it is.

I managed to fix it by only initializing xterm after the div is visible.

It was only happening in the bottom dock when the dock was closed and the Linter panel is in the bottom dock. For some reason Linter makes itself visible when the dock opens making the newly added item (x-terminal) not visible which makes xterm give itself a 0px height and fail when it tries to resize.

@aminya
Copy link
Contributor

aminya commented Aug 5, 2020

I was able to recreate it. It seems that if xterm is initialized with a hidden div than it gives itself a 0px height and fails to restart. I'm thinking this is a bug in xterm but I'm not exactly sure where it is.

I managed to fix it by only initializing xterm after the div is visible.

Great! That's awesome that you found the reason.

It was only happening in the bottom dock when the dock was closed and the Linter panel is in the bottom dock. For some reason Linter makes itself visible when the dock opens making the newly added item (x-terminal) not visible which makes xterm give itself a 0px height and fail when it tries to resize.

This is really annoying. Can we make a PR to linter UI to fix this? I tend to open and close the terminal a lot, but this linter enforcing focus is annoying.

@UziTech
Copy link
Member Author

UziTech commented Aug 5, 2020

This is really annoying. Can we make a PR to linter UI to fix this? I tend to open and close the terminal a lot, but this linter enforcing focus is annoying.

I created an issue on the linter-ui-default repo: steelbrain/linter-ui-default#582

@UziTech UziTech changed the title fix: don't resize terminal when hidden fix: fix terminal resize when hidden Aug 5, 2020
@UziTech UziTech merged commit 025cd5d into master Aug 5, 2020
@UziTech UziTech deleted the fix-resize-observer branch August 5, 2020 05:44
@github-actions
Copy link

github-actions bot commented Aug 5, 2020

🎉 This PR is included in version 9.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released 📮 Release has been made label Aug 5, 2020
@Abhi2019
Copy link

I am getting the same issue when doing resizing the terminal.

<ResizeObserver
onResize={(rect) => {
fitAddon.fit();
console.log("Resized. New bounds:", rect.width, "x", rect.height);
}}
onPosition={(rect) => {
console.log("Moved. New position:", rect.left, "x", rect.top);
}}
/>

It was providing NaN value to the resize function, could someone look into this.

@UziTech
Copy link
Member Author

UziTech commented Sep 16, 2021

@Abhi2019 Can you create a new issue and fill out the template so we can track your error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released 📮 Release has been made
Development

Successfully merging this pull request may close these issues.

Terminal output cleared with multiple tabs [BR]
3 participants