patternfly-yew / patternfly-yew/patternfly-yew

[Disucssion] handling the "middle" truncation option

Open
#93 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted question
Dominant language
Rust
Stars
166
Forks
39
Avg merge
1d 1h
Merged PRs (30d)
2

Description

Continuing from https://github.com/patternfly-yew/patternfly-yew-quickstart/pull/36#issuecomment-1820466741:

Looks good to me, it might be worth adding a comment in the docs saying that the truncate doesn't necessarily truncate num grapheme clusters but rather rounds down to the next unicode codepoint after num bytes.

I'm not sure if adding any extra complexity to the code is worth it though. At best you could maybe trim off num unicode codepoints by using s.char_indices().rev().nth(num) which will still look weird in a lot of cases and anything better than that will require an extra dependency. So a comment would probably be good, just so people aren't surprised that there are only 5 characters visible when they wanted to keep 10.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the discussion linked from PR #36 and review the existing truncation behavior, especially the proposed middle option and Unicode handling. Determine whether the desired outcome is an implementation change or documentation clarification; done should be an agreed behavior for middle truncation, with the relevant documentation updated if that is the selected resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.