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

Client cuts numbers at the beginning of a sentence #14621

Open
Tracked by #189
Me4Linux opened this issue Jul 18, 2020 · 32 comments
Open
Tracked by #189

Client cuts numbers at the beginning of a sentence #14621

Me4Linux opened this issue Jul 18, 2020 · 32 comments
Labels
A-Composer A-Timeline good first issue Good for newcomers Hacktoberfest Issues which are suitable for Hacktoberfest PRs: https://hacktoberfest.digitalocean.com/ Help Wanted Extra attention is needed O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Upstream

Comments

@Me4Linux
Copy link

Description

When you write a number (3-9 digits) followed by a dot (".") the client drops all digits but the final two.

Steps to reproduce

Write into chat: 123456789.
gives: 89

Or: 500.
shows: 00.

numbers-bug

Version information

  • Platform: web (in-browser) or desktop? Desktop

  • OS: Debian Buster, confirmed by chat partner with client under iOS and MacOS X.

  • Version: 1.7.1

@Me4Linux
Copy link
Author

Correction: numbers are not dropped, but shifted to the left.

@t3chguy
Copy link
Member

t3chguy commented Jul 19, 2020

Screenshot for dev:

image

This is because the left-padding is fixed to 2em so doesn't allow list integers higher than that
(+ the fact that CommonMark interprets 500. as a list)

@Me4Linux
Copy link
Author

Thank's for the confirmation, t3chguy.
Devs: is it possible to change the behaviour to start two lines with numbers instead of one before a list is supposed? Like:

  1. Text.
  2. Now we're sure that's a list.

@t3chguy
Copy link
Member

t3chguy commented Jul 21, 2020

That would be a query for https://commonmark.org/ as that is the markdown parser used

@Yoric
Copy link
Contributor

Yoric commented Nov 3, 2020

So, this could be fixed by a CSS change, right?

@t3chguy
Copy link
Member

t3chguy commented Nov 3, 2020

Yes. The current faulty style comes from http://ungoldman.github.io/gfm.css/ but can be overridden in our CSS.

@chagai95
Copy link
Contributor

Anyone planning on fixing this? Would be nice to know where this is on the roadmap 🙈

@t3chguy t3chguy added the Help Wanted Extra attention is needed label Jun 14, 2021
@SimonBrandner SimonBrandner added Z-Upstream O-Occasional Affects or can be seen by some users regularly or most users rarely and removed P2 labels Aug 27, 2021
@dkasak
Copy link
Member

dkasak commented Aug 29, 2021

Devs: is it possible to change the behaviour to start two lines with numbers instead of one before a list is supposed?

That would be a query for https://commonmark.org/ as that is the markdown parser used

This isn't strictly related to CommonMark, as this is primarily a question of whether we consider a particular message to be Markdown at all. We already treat certain messages as plain text instead of Markdown, such as when they only contain text nodes or disallowed HTML tags.

I think the suggested rule of only considering something to be a list when it has two items is a good one and would increase usability. At the very least, we should consider lists with a single empty item to be a plain text (i.e. non-Markdown) message. I'd volunteer to implement this as it has been irking me for some time. This would be a separate change to the proposed CSS fix above.

@SimonBrandner
Copy link
Contributor

I'd volunteer to implement this as it has been irking me for some time

Sure, go ahead!

@germain-gg germain-gg added good first issue Good for newcomers and removed Help Wanted Extra attention is needed labels Sep 2, 2021
@neer17
Copy link

neer17 commented Sep 29, 2021

@SimonBrandner Since there is no activity on this for a month, so can I work on this?

@SimonBrandner
Copy link
Contributor

@SimonBrandner Since there is no activity on this for a month, so can I work on this?

I am a bit unsure atm, isn't this solved by matrix-org/matrix-react-sdk#6833?

Also, no need to ping me specifically

@dkasak
Copy link
Member

dkasak commented Sep 29, 2021

Just to clarify, no, matrix-org/matrix-react-sdk#6833 doesn't fix this, except as a side-effect in a particular sub-case. That PR makes Element Web stop treating messages such as this one as Markdown:

2021.

This has the side-effect of sidestepping the current faulty formatting. However, messages such as the following one are still treated as a Markdown list:

2021. foo

Since the CSS for Markdown lists is still incorrect, the number would still be cut off in this case. So @neer17 if you'd like to take a stab at fixing this, go for it.

@sakshi-0206
Copy link

Hey @dbkr @SimonBrandner
I am an Outreachy applicant and would like to work on this issue. Can you assign this to me?

@SimonBrandner
Copy link
Contributor

Hey @dbkr @SimonBrandner I am an Outreachy applicant and would like to work on this issue. Can you assign this to me?

I've assigned you to the issue. If you need any help/have any questions be sure to visit #element-dev:matrix.org!

@ttheshreeyasingh
Copy link
Contributor

@sakshi-0206 If you're not currently working on this issue? Can I be assigned this issue as well?

@t3chguy
Copy link
Member

t3chguy commented Apr 12, 2022

Clearing assignment as per https://github.com/vector-im/element-meta/wiki/Guidance-on-assigning-issues - anyone is welcome to work on this, once you have a draft feel free to mention it here and we can set assignment then!

@BalanaguYashwanth
Copy link

Hello @Me4Linux,

I see some PR's had raised for this issue. Can you check if it is solved this issue ?

@Me4Linux
Copy link
Author

Hi, @BalanaguYashwanth

I'm using V1.11.23 now. Still got the problem here that numbers up to 9 digits are truncated. 10 or more work. For example I write: 123456789.
Element-Desktop shows: 89. (and I see some pixels of the digit "7")
But when I write: 1234567890.
Element shows: 1234567890.

@BalanaguYashwanth
Copy link

ok

@Johennes Johennes added the Hacktoberfest Issues which are suitable for Hacktoberfest PRs: https://hacktoberfest.digitalocean.com/ label Oct 24, 2023
@ara4n
Copy link
Member

ara4n commented Jan 14, 2024

the workaround to this is to override the 2em in the CSS from gfm.css

.markdown-body ol, .markdown-body ul {
    padding: 0 0 0 2em;
}

...and I guess do some dirty heuristic to do that automatically the string length of the number is too wide.

@aditjya
Copy link

aditjya commented Feb 20, 2024

is this still open?

@t3chguy
Copy link
Member

t3chguy commented Feb 20, 2024

image

Yes.

@aditjya
Copy link

aditjya commented Feb 20, 2024

Hi @t3chguy i'm new here can you tell me what is the problem to solve? please..

@t3chguy
Copy link
Member

t3chguy commented Feb 20, 2024

The OP describes it pretty well #14621 (comment) - they write a number, only the last 2 digits or so are rendered, the rest is cut off.

@aditjya
Copy link

aditjya commented Feb 20, 2024

so i need to make it render all the input digits
right?

@t3chguy
Copy link
Member

t3chguy commented Feb 20, 2024

Yes, that would be the solution

@aditjya
Copy link

aditjya commented Feb 20, 2024

This might be my first contribution. I'll try my best!

@shadow-identity
Copy link

shadow-identity commented Mar 2, 2024

Happens on iOS client:

  • peer types: 46) and sends the message using Element for iOS
  • peer doesn't see the sent message
  • I see the message, but what I see is 46.
  • In the "View Source" dialog I see:
{
  "content": {
    "body": "46)",
    "format": "org.matrix.custom.html",
    "formatted_body": "<ol start=\"46\">\n<li></li>\n</ol>",
    "msgtype": "m.text"
  },
  "room_id": "xxx",
  "type": "m.room.message"
}

Want to point additional attention (since original bug description has a bit different reproduction) that the peer does not see its message at all.
If it sends 46) hi peer sees like hi, the message content on my side is

{
  "content": {
    "body": "46) hi",
    "format": "org.matrix.custom.html",
    "formatted_body": "<ol start=\"46\">\n<li>hi</li>\n</ol>",
    "msgtype": "m.text"
  },
  "room_id": "!HnLctILERbiRchRZkp:pavli.cc",
  "type": "m.room.message"
}

@t3chguy
Copy link
Member

t3chguy commented Mar 4, 2024

Happens on iOS client:

@shadow-identity https://github.com/element-hq/element-ios is the repo for iOS issues.

@sarans-h
Copy link

Is the issue fixed??

@dkasak
Copy link
Member

dkasak commented Oct 30, 2024

It's not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Composer A-Timeline good first issue Good for newcomers Hacktoberfest Issues which are suitable for Hacktoberfest PRs: https://hacktoberfest.digitalocean.com/ Help Wanted Extra attention is needed O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Upstream
Projects
None yet
Development

No branches or pull requests