Skip to content

Conversation

@michaelhart
Copy link
Contributor

@michaelhart michaelhart commented Sep 4, 2025

Adds methods to replace non-ASCII characters and truncate text with ellipsis based on available width in Recent adverts. For devices like the Nano G2 Ultra, this addresses the multiple glitched characters that a single emoji would render as and instead shows "".

Lilygo T-Echo Before and After:

image image

Nano G2 Ultra Before and After:

image image

Note: This doesn't address text truncation of the companion node name in the top, only in the list of recently heard adverts.

@michaelhart michaelhart force-pushed the node-displayname-improvements branch 2 times, most recently from 0e8b8f2 to 834b801 Compare September 4, 2025 10:12
@liamcottle
Copy link
Member

Tested on ThinkNode M1, looks much better. Thanks for contributing! :) I'll leave the code review for Scott.

@liamcottle liamcottle requested a review from ripplebiz September 4, 2025 10:21
}
}
dest[j] = 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The method name is a bit confusing. Maybe something like 'translateUTF8toBlocks()' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done ✅

text[--len] = 0;
}
strcat(text, ellipsis);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have actually been meaning to introduce something like this, but at the DisplayDriver level.
If you look at drawTextCentered() for instance, there is a dumb, generic impl there, but it can be overridden by sub-classes if the particular display has a better way of doing it.
Would be good to have a new DisplayDriver method, say, drawTextEllipsized(x, y, w, str) with a basic imp like above, but where display-specific could have some optimised impl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Relocated; let me know if that isn't how you had intended

@michaelhart michaelhart force-pushed the node-displayname-improvements branch 2 times, most recently from e555f6e to df41257 Compare September 17, 2025 00:10
@liamcottle
Copy link
Member

Could this be refactored into a display driver helper such as drawTextEllipsized as mentioned by Scott?
Would allow for using in other parts of the UI without much fuss :)

Just noticed a bunch of other commits get merged/forced in.
I'm assuming this was main into dev, or dev into main.
Maybe this PR should be rebased onto current dev branch so we don't have the mess of the other commits.

Definitely keen to see this UI improvement make it into firmware.

@liamcottle
Copy link
Member

liamcottle commented Sep 17, 2025

Oh, it looks like you did that! Nice. Missed it within all those other commits :D I would definitely recommend a rebase of your branch to clean up the commit diff.

- Add translateUTF8ToBlocks() method to convert UTF-8 characters to displayable blocks
- Add drawTextEllipsized() method for text truncation with ellipsis
- Apply UTF-8 filtering to node names, recent contacts, and message content
- Use ellipsized text rendering for recent contacts to prevent overflow
- Addresses PR feedback by moving text processing to DisplayDriver level
@michaelhart michaelhart force-pushed the node-displayname-improvements branch from df41257 to bd6aa98 Compare September 17, 2025 00:17
@michaelhart
Copy link
Contributor Author

Sorry I had to go on a choose your own adventure with git to get the PR clean again. I think it should be ready for review again now 😅

@ripplebiz ripplebiz merged commit f77fd15 into meshcore-dev:dev Sep 18, 2025
agessaman pushed a commit to agessaman/MeshCore that referenced this pull request Nov 8, 2025
…-improvements

Adds name filtering and text truncation for display in HomeScreen
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