Skip to content

refactor: remove unused maxchars dead code#740

Merged
Samillion merged 1 commit into
mainfrom
maxchars_unused
May 2, 2026
Merged

refactor: remove unused maxchars dead code#740
Samillion merged 1 commit into
mainfrom
maxchars_unused

Conversation

@Samillion
Copy link
Copy Markdown
Owner

Changes:

  • Remove unused maxchars dead code
    • All this time maxchars was set to nil, so the condition is never true and never runs
    • ModernZ relies on clipping the title(s) based on window width, not maximum characters count
    • This works in osc.lua with fixed width layouts, ours is more dynamic and adjusts based on window size

Note:
While we can simply assign an arbitrary value to maxchars (e.g. 150 characters), the change it applies looks unpleasant. It's not just a simple adding of three dots at the end. It uses \\fscx to shrink it, which makes the title look compressed and weird.

However, I'm open to suggestions, this doesn't have to be removed if it can be used properly.

@Samillion
Copy link
Copy Markdown
Owner Author

Alternatively, should we turn this maxchars = nil, into a user option to be controlled, nil by default?

It was requested here #726 by @yannikthegenius (it's how I realized this was deadcode all this time)

My objection isn't the feature itself, it's how it makes the title(s) look.

Obligatory cc to @Keith94 and @nekoxuee

@Keith94
Copy link
Copy Markdown
Contributor

Keith94 commented May 1, 2026

It uses \fscx to shrink it, which makes the title look compressed and weird.

The shrinking is probably not the best idea. It's better to have only ellipsis when the title exceeds. I was playing around with it here: Keith94@b1b8dc4

User option is likely not necessary.

@nekoxuee
Copy link
Copy Markdown
Contributor

nekoxuee commented May 2, 2026

I agree that shrinking is undesirable.

@Samillion
Copy link
Copy Markdown
Owner Author

Samillion commented May 2, 2026

The shrinking is probably not the best idea. It's better to have only ellipsis when the title exceeds. I was playing around with it here: Keith94@b1b8dc4

Beautiful, much cleaner.

Question: should the states be initiated as an infinite number? In other words, can they be initiated as nil or 0, then assigned value on actual use/render instead?

Either way, I'll merge this, then you feat PR your idea, sounds good?

@Keith94
Copy link
Copy Markdown
Contributor

Keith94 commented May 2, 2026

Either way, I'll merge this, then you feat PR your idea, sounds good?

Okay, sounds great. I'll do it tomorrow.

@Samillion Samillion merged commit f4ab339 into main May 2, 2026
@Samillion Samillion deleted the maxchars_unused branch May 2, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants