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

Terminal uses system default for number of rows scrolled at a time. Can be overridden in settings file. #3575

Merged
merged 19 commits into from
Jan 6, 2020

Conversation

hannesne
Copy link
Member

@hannesne hannesne commented Nov 14, 2019

The terminal will use the system setting to determine the number of lines to scroll at a time.
This can be overridden by adding rowsToScroll to app global settings file.
terminal will use the system setting if the app setting is 0, or not specified. No restart is needed to reflect setting changes in system or the settings file.

The default was hardcoded to 4 in the code with a todo comment. 1 works better on precision touchpads, where 4 scrolls too fast.

  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Validation Steps Performed

  1. Launch terminal
  2. cat a large file so that there are many lines to scroll in between.
  3. Launch settings editor.
  4. Add rowsToScroll: 1 to global settings, and save the file.
  5. Scroll the page, it should now go nice and slow.
  6. Change the setting to 20, and save the file.
  7. Scrolling should now be super fast.
  8. Restart the terminal, and verify that scrolling is still super fast.
  9. Set rowsToScroll to 0 in settings and save the file.
  10. Verify that scrolling happens at system setting.
  11. Change system setting to max and switch focus back to terminal to see scrolling happen very fast.
  12. Change system setting to minimum and see scrolling happen very slow.

Example of profiles.json file:

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "rowsToScroll": 1,

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore"
        },
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "hidden": false,
            "name": "Ubuntu-18.04",
            "source": "Windows.Terminal.Wsl"
        }
    ],

    // Add custom color schemes to this array
    "schemes": [],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

@mdtauk
Copy link

mdtauk commented Dec 2, 2019

The default should probably match the Windows settings for scrolling, with a default option as well as overriding with custom values.
image

@hannesne
Copy link
Member Author

hannesne commented Dec 4, 2019

I've done it! The terminal will now use the system setting for lines scrolled. This can be overridden by specifying a value in the app settings file. If the value specified is 0, terminal will use the system setting. cc @mdtauk

… focus, not on every scroll event. More efficient.
@hannesne hannesne changed the title Added setting in global settings to configure the number of rows scrolled at a time Terminal uses system default for number of rows scrolled at a time. Can be overridden in settings file. Dec 4, 2019
@DHowett-MSFT
Copy link
Contributor

(Sorry for the silence here! We've been trying to stay on top of our PR backlog, but with the November-December holiday seasons here in the US our velocities aren't as great as we'd like.)

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Personally don't like that 0 or null are considered the system setting. I'd prefer something like "system" for the system setting or a number for the number. We should probably just invalidate the profile if 0 or null are passed in. Then throw a warning? @DHowett-MSFT @cinnamon-msft thoughts?

Also, please update the following too:

src/cascadia/TerminalControl/TermControl.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/TermControl.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/defaults.json Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 11, 2019
@hannesne
Copy link
Member Author

Personally don't like that 0 or null are considered the system setting. I'd prefer something like "system" for the system setting or a number for the number. We should probably just invalidate the profile if 0 or null are passed in. Then throw a warning? @DHowett-MSFT @cinnamon-msft

@carlos-zamora
Supporting this requires changing the setting type to string (currently it's integer). It adds additional complexity by then requiring specialised parsing in the code. Given that the real default is to not specify it, I'm not sure if it's worth the effort at this point?

I've implemented all the other requested changes.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Largely I really like this - I just think we need to move the SystemParametersInfo call to where we're parsing instead of in TermControl.

I'd similarly prefer that we use "system" to indicate using the system scroll amount, as opposed to null/0, but that can always be done in a follow-up PR.

src/cascadia/TerminalControl/TermControl.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/defaults.json Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/GlobalAppSettings.cpp Outdated Show resolved Hide resolved
src/inc/DefaultSettings.h Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 12, 2019
@hannesne
Copy link
Member Author

hannesne commented Dec 13, 2019

I didn't like calling the system for the setting in the termcontrol either, so I've changed it now so that the globablappsettings will assign 0 to the internal value if anything other than a non-zero int value is in the settings when parsing the settings file (the default is now "system"). The terminal settings will then in the accessor determine if a valid setting is provided, falling back to the system setting. The terminal control will update it's internal value using that accessor when settings change and when it receives focus so that you don't have to restart the terminal when you change the system setting. @zadjii-msft

@zadjii-msft zadjii-msft added the Product-Terminal The new Windows Terminal. label Dec 13, 2019
@ghost ghost requested review from miniksa and DHowett-MSFT December 13, 2019 13:27
@zadjii-msft zadjii-msft added this to the Terminal-2001 milestone Dec 30, 2019
@miniksa
Copy link
Member

miniksa commented Dec 30, 2019

Not going to override @carlos-zamora because I don't see an answer to the thing he specifically asked of @DHowett-MSFT and @cinnamon-msft regarding using the 0/null state for "get system default".

@hannesne
Copy link
Member Author

hannesne commented Jan 4, 2020

@carlos-zamora requested changes have been addressed by making "system" the default option in the settings file. Any value that is not 0 or an integer (null, "system", or not specified) will default to using the system setting. cc @miniksa

@miniksa
Copy link
Member

miniksa commented Jan 6, 2020

@carlos-zamora Carlos Zamora FTE requested changes have been addressed by making "system" the default option in the settings file. Any value that is not 0 or an integer (null, "system", or not specified) will default to using the system setting. cc @miniksa Michael Niksa FTE

Ah alright. Sorry, that wasn't clear to me sooner.

Also, I checked the calendar and @carlos-zamora isn't due back for another week, so I'm going to clear his review and merge this.

@miniksa miniksa dismissed carlos-zamora’s stale review January 6, 2020 17:38

He's OOF and his issues have been addressed, as far as I can discern.

@miniksa miniksa merged commit a60ed52 into microsoft:master Jan 6, 2020
@hannesne
Copy link
Member Author

hannesne commented Jan 7, 2020

Thank you for the support @miniksa ! :)

@hannesne hannesne deleted the hannesne/configure_rows_scrolled branch January 7, 2020 08:05
Comment on lines 433 to 438
"globals": {
"alwaysShowTabs": true,
"initialCols" : 120,
"initialRows" : 30
"initialRows" : 30,
"rowsToScroll" : 4,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure why this wasn't picked up by the build bot, but this test now fails for me when run locally because of the trailing comma (that's not valid JSON).

@ghost ghost removed the Needs-Second It's a PR that needs another sign-off label Jan 7, 2020
@zadjii-msft
Copy link
Member

@j4james the tests all defined in LocalTests_TerminalApp don't actually run in CI - it's been my monthslong hell to try and make that work ;___;

See #3838 for the most recent incarnation of fixing them.

I'll move your comment to it's own issue, cause that should be fixed.

@ghost
Copy link

ghost commented Jan 14, 2020

🎉Windows Terminal Preview v0.8.10091.0 has been released which incorporates this pull request.:tada:

Handy links:

@realdadfish
Copy link

I'm running v0.8.10091.0, but the setting is not visible in the default (generated) settings JSON. Was it forgotten to be added there or is the auto-generation of the default setting value not implemented...?

Basically, people don't know the setting exists until they stumble upon this PR or the accompanying issue.

@DHowett-MSFT
Copy link
Contributor

Hey @hannesne! It looks like somebody came through and fixed the scroll wheel deltas, which obviates the need for rowsToScroll. It feels really great in the default configuration, but right now if you set rowsToScroll to 1, it'll have somewhat of an adverse effect on your ability to scroll 😦

I can send you a release build from master if you want to give it a test.

Should we revert this feature, or change the key name so users who set 1 aren't left surprised when their scrolling is suddenly 3x slower than it used to be?

@yogan
Copy link

yogan commented Nov 29, 2020

I'm confused here. The v1.5.3142.0 release notes said:

The scrollUp and scrollDown actions have learned about rowsToScroll (thanks @Don-Vito!) (#7924)

But the config schema docs tell me that rowsToScroll is no longer a thing?

image

Unfortunately the config docs seem to be right. No matter what (numeric) value I set, I only get three lines of
scrolling (my System setting). I don't want to change that, it's fine for most apps and would also be fine for
mouse wheel scrolling in WT, but I'd like to get usable keyboard scrolling, and for that 3 is way to low for me,
that means I have to smash those keys like a maniac. ;-)

Running v1.5.3242.0 here.

@Don-Vito
Copy link
Contributor

@yogan - you can now set rowsToScroll as a part of the binding, something like:

{ "command": {"action": "scrollUp", "rowsToScroll":16}, "keys": "ctrl+shift+up" },

@yogan
Copy link

yogan commented Nov 29, 2020

Perfect! Just what I was looking for. Thanks @Don-Vito!

Maybe add a hint like that to the docs of the global rowsToScroll option instead or in addition to that deprecation notice to let others find about it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants