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

scroll wheel sends escape sequences in alternate screen mode #282

Closed
wants to merge 3 commits into from

Conversation

mmaxim
Copy link
Contributor

@mmaxim mmaxim commented May 8, 2016

The point of this patch is to add an option to make the mouse scroll wheel configurable to send escape sequences in alternate screen mode. This adds onto the similar arrow key option that is already present by creating two more configuration options in the Advanced pane.

The motivation for this change is to be able to implement the technique described here:
https://www.staldal.nu/tech/2009/01/11/how-to-use-mousewheel-in-gnu-screen/

Note: I'm not an Objective-C expert by any means, so I won't be surprised if I did something here that isn't best practice.

… sequences on scroll in alternate screen mode
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3bfaee3 on mmaxim:mmaxim/scroll-wheel-escape into * on gnachman:master*.

@@ -1546,7 +1546,7 @@ - (void)rightMouseDragged:(NSEvent *)event
[super rightMouseDragged:event];
}

- (BOOL)scrollWheelShouldSendArrowForEvent:(NSEvent *)event at:(NSPoint)point {
- (BOOL)scrollWheelShouldSendAuxForEvent:(NSEvent *)event at:(NSPoint)point upData:(NSData**)upData downData:(NSData**)downData {
Copy link
Owner

Choose a reason for hiding this comment

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

Let's separate computing the data to send from determining if data should be sent. That means two methods:

- (BOOL)scrollWheelShouldSendDataForEvent:(NSEvent *)event

(by not taking a point we're doing a touch of cleanup here since the point can be computed from the event and the caller doesn't need it for anything but passing to this method)

and

- (NSData *)dataToSendForScrollEvent:(NSEvent *)event

which calls enclosingScrollView and accumulateVerticalScrollFromEvent, and then returns the appropriate data.

@mmaxim
Copy link
Contributor Author

mmaxim commented May 15, 2016

@gnachman Thanks for the response! I pushed some changes which I think addresses all of your feedback. Let me know, and thanks!

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ae3ace1 on mmaxim:mmaxim/scroll-wheel-escape into * on gnachman:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ae3ace1 on mmaxim:mmaxim/scroll-wheel-escape into * on gnachman:master*.

@gnachman
Copy link
Owner

Merged as commit 9c63f6f. Thanks!

@gnachman gnachman closed this May 16, 2016
@mmaxim
Copy link
Contributor Author

mmaxim commented May 16, 2016

Great, thanks!

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