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

"clear" broken on Windows when using with Git BASH #1559

Open
keirlawson opened this issue Feb 20, 2017 · 45 comments
Open

"clear" broken on Windows when using with Git BASH #1559

keirlawson opened this issue Feb 20, 2017 · 45 comments
Labels
🖼 Platform: Windows Issue pertains to Windows 🐛 Type: Bug Issue pertains to something wrong within Hyper

Comments

@keirlawson
Copy link

keirlawson commented Feb 20, 2017

  • OS version and name: Windows 10 version 1607 build 14393.693
  • Hyper.app version: 1.2.1
  • Link of a Gist with the contents of your .hyper.js: link
  • Relevant information from devtools: N/A
  • The issue is reproducible in vanilla Hyper.app: Is Vanilla

Issue

I've set up Hyper on Windows to use the bash that comes bundled with Git for windows, however when I run the clear command, the contents of the window is not cleared, though the prompt does move back to the top of the screen, over the top of the pervious content.

@jmcmellen
Copy link

I was having all kinds of various problems writing to the screen until I set the environment var TERM=msys. I think it was set to cygwin which worked in 1.1.0. Maybe that will help?

@fknop
Copy link

fknop commented Feb 25, 2017

@jmcmellen Solved it for me, thanks.

@keirlawson
Copy link
Author

TERM=msys did not work for me, however TERM=cygwin did :)

@therealplato
Copy link

+1
thx for workaround @keirlawson @jmcmellen

@jamiewade
Copy link

Was having the exact same issue.

Now I'm using the command reset, it also does what clear is supposed to!

@TheMartes
Copy link

Sorry guys I'm pretty new in this, but where i can change that TERM="" variable?

@gsklee
Copy link
Contributor

gsklee commented Mar 4, 2017

@TheMartes ~/.hyper.js

@math2001
Copy link

math2001 commented Mar 5, 2017

@jmcmellen Thanks that worked!

If someone is looking to actually clear the screen (not just scroll down) in bash, here's how:

alias cls="echo -e '\\0033\\0143'"

Then, just type cls.

@MSaIim
Copy link

MSaIim commented Mar 5, 2017

I tried with TERM:'msys' and TERM:'cygwin', but neither clear the screen. It just moves the cursor back to the top. Any other suggestions to fix this?

@vuon9
Copy link

vuon9 commented Mar 6, 2017

@math2001 Thank you! It's useful!

@math2001
Copy link

math2001 commented Mar 6, 2017

@MSaIim what platform are you on? are you using bash from Git On Windows as well?

@vuongggggg: you're welcome! 🙂

@MSaIim
Copy link

MSaIim commented Mar 6, 2017

@math2001 I am on Windows 10 64bit and yes I am use bash from Git on Windows.

@math2001
Copy link

math2001 commented Mar 6, 2017

Did you restarted hyper? did you added TERM: 'cygwin' in the env object?

@MSaIim
Copy link

MSaIim commented Mar 6, 2017

Thank you very much! I didn't put it inside the env object. Thought it was another variable. Works great now.

@math2001
Copy link

math2001 commented Mar 6, 2017

Glad I could help! Could a collaborator or the owner add a tag like has-workaround to this thread please?

@geekosupremo
Copy link

geekosupremo commented Apr 19, 2017

@math2001 Why does your workaround work? Why the extra escaped characters?

alias cls="echo -e '\\0033\\0143'"

@christianwico
Copy link

let gitRootFolder = 'C:\\Users\\${yourName}\\AppData\\Local\\Programs\\Git';

Setting the TERM environment variable to cygwin || msys didn't work for me. My fix was instead of using ${gitRootFolder}\bin\bash.exe, I used ${gitRootFolder}\usr\bin\bash.exe. That one worked for me without a hitch!

@math2001
Copy link

math2001 commented Apr 20, 2017

YES!! This trick seems to make ctrl+c work properly too! Thanks a lot @cnswico!! 🎉 👍 😄

@MartyGentillon
Copy link
Contributor

@geekosupremo the escape characters are the ANSI escape sequence for resetting the terminal "ESC c" You could also write it as:

alis cls="echo -e '\\0033c'"

In general, I would expect clear to do precisely this, but I suppose that it is possible that, if the TERM variable were set incorrectly, it might do something else (for instance if it thought you were using a line or dumb terminal).

@MartyGentillon
Copy link
Contributor

Also, I would set TERM to xterm-256color which is what most terminal emulators that support 256 color set it to.

@MartyGentillon
Copy link
Contributor

Or, for that matter xterm. Hyper is an xterm emulator after all.

@MartyGentillon
Copy link
Contributor

Also, for those of you having problems, it would be helpful to know what you have $TERM set to. The output of:

echo $TERM

would help anyone debugging this issue.

Also, you might want to check your terminal init files to see if they are setting it incorrectly.

@guillemsola
Copy link

I'm losing my text from time to time and I have to do a reset

my $TERM = cygwin

@cnoffsin
Copy link

@christianwico

let gitRootFolder = 'C:\Users\${yourName}\AppData\Local\Programs\Git';
Setting the TERM environment variable to cygwin || msys didn't work for me. My fix was instead of using ${gitRootFolder}\bin\bash.exe, I used ${gitRootFolder}\usr\bin\bash.exe. That one worked for me without a hitch!

Can you explain where to put this info? I am not clear.

@christianwico
Copy link

You place it in your .hyper.js file. You can get to it by opening Hyper and pressing Ctrl + Comma.

Alternatively, you may find the file in your User directory (C:\Users\YourName) and open it using a text editor of your choice.

In the .hyper.js file, look for the shell key and assign the path (which should be C:\Users\YourName\AppData\Local\Programs\Git\usr\bin\bash.exe) I specified. Save the file and reload Hyper.

@jef
Copy link

jef commented Jun 7, 2017

@christianwico still doesn't seem to work. I don't have that bash.exe in that specific path, but it's here: C:\Program Files\Git\usr\bin\bash.exe, but doesn't seem to work. -- just crashes.

@mcrowl-stranger
Copy link

I came here to find this because tools like top and nano were not clearing the screen when rendering, so previous console output was bleeding through anywhere there was space.

Thank you so much for the TERM:"cygwin" solution. Mine was "xterm-256color" by default. (Also using Hyper with Git for Windows bash and Cygwin.)

@gpresland
Copy link

gpresland commented Sep 30, 2017

For Windows 10 users, in Hyper:

> Edit > Preferences...

Add/update the following lines:

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    // make sure to use a full path if the binary name doesn't work
    // (e.g `C:\\Windows\\System32\\bash.exe` instead of just `bash.exe`)
    // if you're using powershell, make sure to remove the `--login` below
    shell: 'C:\\Program Files\\Git\\git-cmd.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],

    // for environment variables
    env: {
      TERM: 'cygwin'
    },

@vallamost
Copy link
Contributor

I'm also still getting issues with the screen buffer failing to clear, tried setting TERM to a variety of different things, nothing seems to work :(

Using the latest version of Hyper, are there any other methods to getting this work?

Just trying to get Hyper and zsh to work on Windows..

@leocavalcante
Copy link

Ha! Thanks!

env: {
  TERM: 'msys'
}

@derksacklowski
Copy link

Neither 'mysys' nor 'cygwin' are helping with the clear issue

(Windows 10 Fall Creators Update)

@cringerjs
Copy link

Any update since Fall Creators Update?

@NEO97online
Copy link

NEO97online commented Jan 30, 2018

The 'cygwin' solution is currently working for me on Windows 10 version 1709 (Fall Creators Update).

env: {
  TERM: 'cygwin'
}

@gdmachado
Copy link

@hermbit the 'cygwin' solution works, but then we lose 256 color support (the colors set up on my PS1 are gone when using TERM: 'cygwin' as opposed to TERM: 'xterm-256color'. Is there any workaround?

@panda-madness
Copy link

panda-madness commented Apr 17, 2018

👍 on losing 256 colors with TERM: cygwin or msys.

@Ricky55
Copy link

Ricky55 commented May 22, 2018

I was having the same issue using clear with Hyper hooked up to Cmdr on Windows 10.
Easiest way I found was to do a ctrl shift k. Works like a charm.
Sorry if someone else has already said this!

@andrewgierens
Copy link

Work around for win10

Install hyper-startup extension
npm install -g hpm-cli
hpm install hyper-startup

Add alias commands
Edit config and add the following

module.exports = {
  config: {
  	...
    commands: ['alias clear="echo -e \'\\0033\\0143\'"', 'clear'],
  },
  ...
};

@bogardt
Copy link

bogardt commented Feb 27, 2019

Microsoft Windows [version 10.0.17134.590]

Set env to cygwin works perfectly for me ;) thx @michaelauderer

        env: {
            TERM: 'cygwin'
        }

@robrtsql
Copy link

robrtsql commented Apr 19, 2019

Has there been a regression here? TERM=cygwin fixes the problem for Hyper 2.1.2, but the issue appears to be back in Hyper 3.0.0-canary.8.

EDIT: Whoops, it looks like it's not the same issue. In the issue I am currently experiencing, TERM=cygwin doesn't fix it, and if you type 'clear' and then click anywhere inside the window, the clear will work. In issue #1559, clicking won't do anything, and the issue is fixed by TERM=cygwin.

@talentlessguy
Copy link

Hyper 3 now doesn't clear the screen, so I have to downgrade to 2. It only clears when clicking on it, but it is very unconvenient.

@SidneyNemzer
Copy link

@talentlessguy make sure your Hyper config has been updated. Hyper 3 uses a different config location and ships with a default config. #3605

@sntnupl
Copy link

sntnupl commented May 29, 2019

Any update on this?
I am having the same issue as reported by @robrtsql and @talentlessguy . Clicking anywhere inside the window clears the screen, but thats very inconvenient.

My hyper config is updated at C:\Users\<username>\AppData\Roaming\Hyper.
Hyper version I am using: 3.0.2 (stable)

@edwardbeckett
Copy link

Also, I would set TERM to xterm-256color which is what most terminal emulators that support 256 color set it to.

Absolutely - I set TERM to xterm-256color in ~/.bashrc as well... That way I have a consistent experience in ssh. However, I think the issue is that /usr/bin/clear isn't sourcing terminfo correctly on msys. However, /usr/bin/clear can also take a term argument...

Using an alias seemed to do the trick for me... alias clear="clear -T linux"

@earonesty
Copy link

earonesty commented Nov 13, 2019

@edwardbeckett Yep, TERM=xterm is one of the most supported across the platforms we use (linux/osx/windows). ansi and vt100 are not available in msys. Type toe to get the list of supported terminal types in msys... the problem is not with clear.

@edwardbeckett
Copy link

ansi and vt100 are not available in msys.
I'm using ConEmu terminal emulator, msys2 bash, msys2 git and I am showing support for both ansi and vt100... Though it's most likely from ConEmu - It supports vt100 and ansi

ansi_vt100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖼 Platform: Windows Issue pertains to Windows 🐛 Type: Bug Issue pertains to something wrong within Hyper
Projects
None yet
Development

No branches or pull requests