How to turn off the Terminal's "Allow mouse reporting"?

Solution 1:

The View > Allow Mouse Reporting menu item does not enable the terminal Mouse Reporting behavior, it merely controls whether Mouse Reporting is allowed.

This gives the user a means to temporarily bypass Mouse Reporting when it has been enabled by application programs, to interact with the terminal view for short periods of time. Also note that you can use the Fn modifier key when clicking, dragging and scrolling to temporarily bypass Mouse Reporting.

Mouse Reporting is not enabled unless application programs running within the terminal request it. Application programs normally do not enable it by default, and must be configured to do so. For example, to enable Mouse Reporting in Vim, one puts set mouse=a into ~/.vimrc.

If you do not want Mouse Reporting to be enabled, configure the appropriate application program(s) to disable it.

Solution 2:

This bug can be worked around by default via an osascript command in your shell startup config (e.g. ~/.zshrc or whatever):

osascript -e 'tell application "System Events" to keystroke "r" using command down'

though this may need if statements to check if a) TERM_PROGRAM is Apple_Terminal and b) perhaps not if sshing in from a not-Mac-using-Terminal.app to a Mac.

Solution 3:

Important semantics aside, it would still be really nice, for at least some of us, to change the default behavior; to disallow Mouse Reporting. (This was a change in behavior, and can get in the way.)

So I created a silly little AppleScript, which now saves me that bother; it's below. Personally, I saved the script as an app, and invoke it via QuickSilver.

(Maybe there are better ways - I'd love to know.)

I was able to find no way to integrate this workaround, directly with Terminal; for example, to replace the default behavior. It can easily be added to the Script menu - though apparently items here, are not eligible for command key equivalents, as may be configured in the "Shortcuts" tab of the "Keyboard" pane of System Preferences. (Indeed, I was unable to affect the "New Window with Profile - " menu item at all.)

AppleScript below:

tell application "Terminal"
    activate
    tell application "System Events" to keystroke "n" using command down
    tell application "System Events" to keystroke "r" using command down
end tell