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

[Settings UI] Represent Cursor Height as a slider #9386

Merged
2 commits merged into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/renderer/dx/CustomTextRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ try
// Enforce min/max cursor height
ULONG ulHeight = std::clamp(options.ulCursorHeightPercent, MinCursorHeightPercent, MaxCursorHeightPercent);
ulHeight = (glyphSize.height<ULONG>() * ulHeight) / 100;
ulHeight = std::max(ulHeight, MinCursorHeightPixels); // No smaller than 1px
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@carlos-zamora, @zadjii-msft what if we restrict the minimum cursor height value to 1px? On values less than 25 the cursor is getting smaller until it reaches the 1px height. If one decreases the value further, it won't change anything.

If you think it's ok, I'll also update the docs.

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with that. 😊


rect.top = rect.bottom - ulHeight;
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/dx/CustomTextRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace Microsoft::Console::Render
Outline
};

constexpr const ULONG MinCursorHeightPixels = 1;
constexpr const ULONG MinCursorHeightPercent = 1;
constexpr const ULONG MaxCursorHeightPercent = 100;

Expand Down