When using emacs in the terminal (with evil mode) clicking on another window causes the mode of emacs to switch to insert and it starts inserting '' around random words in whatever buffer is open. This only happens in terminal mode and I'm not sure how to prevent.
The issue was that I bound M-[ and after using describe key to see what was being sent from clicking the mouse I found a question that described the inability to use M-[ as a binding in terminals
Everything that you communicate to an application inside of a terminal is sent in the form of bytes. Keyboard button presses are bytes, mouse clicks are bytes, all kinds of back–and–forth communication between the application and the terminal happens by sending bytes back and forth.
If the application and the terminal are not using exactly the same byte sequences, then this kind of miscommunication happens. The most important information to know is what value the
TERM variable has in your shell before you run Emacs, and what terminal emulator you are actually using.