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

Alt-modified mousewheel mode and other wheel tweaks #1234

Merged
merged 3 commits into from
Oct 4, 2023

Commits on Oct 4, 2023

  1. Avoid mixed line and page mousewheel scrolling

    Don't convert line scrolling events to page scrolling events when they
    exceed the terminal height, because we don't actually know how many
    lines correspond to a page as far as the application is concerned, or
    whether it supports page up/down events in the first place.
    
    Also, scroll the scrollback by one line less than the terminal height
    when scrolling by pages with the mousewheel, to match what we do for
    PgUp/Dn presses.
    
    Drop len argument from send_keys(), and use NUL-terminated strings
    instead for more flexibility. Put the count argument first.
    ak2 committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    6b59169 View commit details
    Browse the repository at this point in the history
  2. Send Alt modifier with mousewheel events

    If the Alt key is pressed, modify mousewheel events sent as cursor/page
    up/down keycodes or as mintty's application wheel codes accordingly.
    
    In nano, Alt+up/down means scrolling the window instead of moving the
    cursor.
    
    (The Shift and Ctrl modifiers are already used for modifying the scroll
    distance per wheel notch to whole pages or single lines, so don't send
    those.)
    ak2 committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    6b495ec View commit details
    Browse the repository at this point in the history
  3. Add Alt-modified mousewheel mode using DECSET 7765

    When enabled, this sends Alt-modified cursor up/down keycodes for
    mousewheel events. If the Alt key is pressed, unmodified keycodes are
    sent. The mode does not affect page up/down codes.
    
    In the nano editor from version 4.0, the Alt+Up/Down keycodes scroll the
    window instead of moving the cursor. Scrolling straight away is the
    proper action for the mousewheel, whereas moving the cursor only scrolls
    once the cursor reaches the top or bottom.
    
    Less can be configured to scroll on Alt+Up/Down with this in ~/.lesskey:
    \e[1;3A back-line
    \e[1;3B forw-line
    
    Similarly, vim can be configured to do so with this in ~/.vimrc:
    map <M-Up> <C-Y>
    map <M-Down> <C-E>
    imap <M-Up> <C-O><C-Y>
    imap <M-Down> <C-O><C-E>
    ak2 committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    6e86dc7 View commit details
    Browse the repository at this point in the history