When I click on the terminal, strange characters appear

terminaltrackpad

The problem I have happens after a ssh connection has been ended by closing my MacBook (putting it in stand-by mode). I come back and it's written broken pipe.

When I click on the terminal window, a succession of characters appear. If I click several times, then the combination of these characters will appear the same number of times.

By moving my cursor, I can change the combination of letters…
Here, between every line, I moved my cursor somewhere else on my Desktop.

The strange behaviour in image

The content of my ~/.bash_profile is:

# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad

# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'

export TERM="xterm-color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '


# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

# added by Anaconda3 5.2.0 installer
export PATH="/anaconda3/bin:$PATH"

Versions:

  • macOS High Sierra version 10.13.5

Best Answer

You have somehow activated the terminal's mouse tracking mode. This is usually used by terminal applications which accept mouse input (like vim), which can interpret these character sequences as mouse events. The shell does not support mouse input, so it displays these sequences directly.

You can turn off mouse tracking mode by running the reset command in the terminal.

Related Question