Allow Fixing of Row/Col number, resize window only changes font size. #22717

Open
opened 2026-01-31 08:21:25 +00:00 by claunia · 10 comments
Owner

Originally created by @kalyxnz on GitHub (Dec 31, 2024).

Description of the new feature

Allow setting the number of rows and columns to fixed numbers.
If the user then adjusts the size of the window, font size is adjusted instead of adding more rows or columns.

Proposed technical implementation details

No response

Originally created by @kalyxnz on GitHub (Dec 31, 2024). ### Description of the new feature Allow setting the number of rows and columns to fixed numbers. If the user then adjusts the size of the window, font size is adjusted instead of adding more rows or columns. ### Proposed technical implementation details _No response_
Author
Owner

@space-techy commented on GitHub (Jan 10, 2025):

Hello,
Like do you want to adjust font size based on window size and when resizing it should automatically adjust font.
Correct?

@space-techy commented on GitHub (Jan 10, 2025): Hello, Like do you want to adjust font size based on window size and when resizing it should automatically adjust font. Correct?
Author
Owner

@kalyxnz commented on GitHub (Jan 10, 2025):

Hi,Yeah that sounds about right.Set the row and column size on load, and then when the window is resized don’t increase or decrease the number of rows or columns, but only change the font size.Does that make sense?On 10 Jan 2025, at 23:14, Nikhil B Patil @.***> wrote:
Hello,
Like do you want to adjust font size based on window size and when resizing it should automatically adjust font.
Correct?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

@kalyxnz commented on GitHub (Jan 10, 2025): Hi,Yeah that sounds about right.Set the row and column size on load, and then when the window is resized don’t increase or decrease the number of rows or columns, but only change the font size.Does that make sense?On 10 Jan 2025, at 23:14, Nikhil B Patil ***@***.***> wrote: Hello, Like do you want to adjust font size based on window size and when resizing it should automatically adjust font. Correct? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
Author
Owner

@space-techy commented on GitHub (Jan 16, 2025):

@kalyxnz sorry I am not able to understand it!
Can you give a small example??
It would be helpful
Also mac and Linux terminal font size changes as we resize window but till certain level!
Do you mean that?

@space-techy commented on GitHub (Jan 16, 2025): @kalyxnz sorry I am not able to understand it! Can you give a small example?? It would be helpful Also mac and Linux terminal font size changes as we resize window but till certain level! Do you mean that?
Author
Owner

@space-techy commented on GitHub (Jan 18, 2025):

@kalyxnz can you explain please?

@space-techy commented on GitHub (Jan 18, 2025): @kalyxnz can you explain please?
Author
Owner

@kalyxnz commented on GitHub (Jan 21, 2025):

Hi sorry for the slow reply.

I will describe the intended behaviour:

Set "Columns" and "Rows" in the settings to desired numbers e.g. 100 Columns 40 rows
This would be at whatever the "Default Font size" is initially so that the window can open on the screen.

Then, a setting to lock those column/row numbers, so that even when the user resizes the window, the columns or rows do not either increase or decrease.
Instead the size of the font either increases (effectively making everything larger looking) or the font size decreases (effectively making everything look smaller).

@kalyxnz commented on GitHub (Jan 21, 2025): Hi sorry for the slow reply. I will describe the intended behaviour: Set "Columns" and "Rows" in the settings to desired numbers e.g. 100 Columns 40 rows This would be at whatever the "Default Font size" is initially so that the window can open on the screen. Then, a setting to lock those column/row numbers, so that even when the user resizes the window, the columns or rows do not either increase or decrease. Instead the size of the font either increases (effectively making everything larger looking) or the font size decreases (effectively making everything look smaller).
Author
Owner

@kalyxnz commented on GitHub (Jan 27, 2025):

Hi @space-techy

I created the following GIF to help illustrate what I mean...

Image

Hope this makes it a little clearer?

Thanks!

@kalyxnz commented on GitHub (Jan 27, 2025): Hi @space-techy I created the following GIF to help illustrate what I mean... ![Image](https://github.com/user-attachments/assets/2a325dd2-18e4-4e6a-9e8f-e58d57390f29) Hope this makes it a little clearer? Thanks!
Author
Owner

@space-techy commented on GitHub (Jan 27, 2025):

@kalyxnz yes it makes clearer now!
Okay I will work on it!
Also do you have any code pointers or area where I can find the code to this?
Bcz reading whole lot of documentation is difficult for me!
Also about this feature do we need to give an option where this would happen only when we turn it on or provide it universally?

@space-techy commented on GitHub (Jan 27, 2025): @kalyxnz yes it makes clearer now! Okay I will work on it! Also do you have any code pointers or area where I can find the code to this? Bcz reading whole lot of documentation is difficult for me! Also about this feature do we need to give an option where this would happen only when we turn it on or provide it universally?
Author
Owner

@kalyxnz commented on GitHub (Jan 27, 2025):

@space-techy
Sorry, someone else would have to point you in the right direction of where the relevant code is.|

A check box with something like: "Keep number of rows and columns static, only increase or decrease font size when window is resized"

@kalyxnz commented on GitHub (Jan 27, 2025): @space-techy Sorry, someone else would have to point you in the right direction of where the relevant code is.| A check box with something like: "Keep number of rows and columns static, only increase or decrease font size when window is resized"
Author
Owner

@kalyxnz commented on GitHub (May 29, 2025):

@space-techy Any luck figuring out how to do this?

@kalyxnz commented on GitHub (May 29, 2025): @space-techy Any luck figuring out how to do this?
Author
Owner

@j4james commented on GitHub (May 30, 2025):

I don't know this part of the code base very well, but if I were going to attempt this feature, I'd start by looking at PR #3181, which added the "snap to character grid" functionality. Because I suspect this feature would work in a similar manner.

  1. You'd need to trap the window resize events.
  2. You'd then need to calculate the most appropriate font size for the new dimensions.
  3. You'd also need to adjust the final size, taking the the new font into account, to make sure the window still holds the original number of rows and columns.

Step two could be tricky, because it can't just be the largest font size that fits in the available space - it needs to take into account what kind of change is being made. For example, if I make the window wider, I would expect that to force a larger font, even though it wouldn't fit the current height - the height would have to grow automatically to make it fit.

Another approach that might work would be to allow the width and height to be changed independently, but have the font stretch to whatever aspect ratio best fits the resulting dimensions. However, I suspect that would require some kind of stretching operation in the renderer rather than a font size change, and that may be more complicated.

@j4james commented on GitHub (May 30, 2025): I don't know this part of the code base very well, but if I were going to attempt this feature, I'd start by looking at PR #3181, which added the "snap to character grid" functionality. Because I suspect this feature would work in a similar manner. 1. You'd need to trap the window resize events. 2. You'd then need to calculate the most appropriate font size for the new dimensions. 3. You'd also need to adjust the final size, taking the the new font into account, to make sure the window still holds the original number of rows and columns. Step two could be tricky, because it can't just be the largest font size that fits in the available space - it needs to take into account what kind of change is being made. For example, if I make the window wider, I would expect that to force a larger font, even though it wouldn't fit the current height - the height would have to grow automatically to make it fit. Another approach that might work would be to allow the width and height to be changed independently, but have the font stretch to whatever aspect ratio best fits the resulting dimensions. However, I suspect that would require some kind of stretching operation in the renderer rather than a font size change, and that may be more complicated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22717