iTerm2 icon indicating copy to clipboard operation
iTerm2 copied to clipboard

Add alternate scroll mode (xterm)

Open saitoha opened this issue 11 years ago • 1 comments

Some days ago, the "alternate scroll" feature was introduced by #164. I think this should be also implemented as a terminal mode. This patch do it.

Additionally, we may had better to rename the hidden preference "alternateMouseScroll" to "forceAlternateMouseScroll".

Usage:

To use this with vim, add the following code to your .vimrc. (This also works on mintty, xterm, TeraTerm, RLogin, mlterm, tanasinn, ...etc)

  set mouse=
  let &t_ti = &t_ti . "\e[?1007;7786h"
  let &t_te = "\e[?1007;7786l" . &t_te

Note:

This patch uses the "alternate screen mode" state as the trigger of enabling/disabling alternate scrolling feature (This behavior is compatible with XTerm). But Tera Term dares to use "application cursor mode" (DEC specific mode 1) instead of that. This hack has the following merits:

  • On some systems(such as FreeBSD), alternate scroll is not enabled by fullscreen applications such as less/vi because the default termcap for xterm is modified and does not include ti/te. But ks/ke are always invoked.
  • tmux does not sends internal state of "alternate screen mode" to outer terminals. But it sends "application cursor mode" state.
  • Some people disables alternate screen feature by using custom terminfo or terminal preferences.

saitoha avatar Mar 19 '14 15:03 saitoha

I'd be OK with using application keypad mode to turn on alternate scroll mode as long as the advanced setting is also enabled. But it should work even if allowKeypadMode is NO. Feel free to add it to this pull request or send a separate one for that if you like.

gnachman avatar Mar 24 '14 06:03 gnachman