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

Add alternate scroll mode (xterm) #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saitoha
Copy link
Contributor

@saitoha saitoha commented Mar 19, 2014

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.

@@ -145,6 +145,7 @@ - (id)init
bgColorCode_ = ALTSEM_DEFAULT;
bgColorMode_ = ColorModeAlternate;
_mouseMode = MOUSE_REPORTING_NONE;
_alternateScrollMode = NO;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to initialize ivars to NO in -init because they're zeroed out during allocation.

@gnachman
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants