Skip to content

@usernames aren't linked at the beginnings of lines, except for the first line #267

Description

@phil-s

For the following example message, the first username on the second line does not end up linked:

@phil.catalyst:matrix.org linked? @phil.catalyst:matrix.org linked?
@phil.catalyst:matrix.org linked? @phil.catalyst:matrix.org linked?

So the respective output end up like this:

phil.catalyst​:
11:40 phil.catalyst linked? phil.catalyst linked? @phil.catalyst:matrix.org linked? phil.catalyst linked?

It looks like the issue is the regexp in ement--format-body-mentions. For a @ immediately following a newline, that initial (or bos bow (1+ blank)) doesn't match because @ isn't word syntax, and newlines aren't [:blank:]. Let's simply add a newline to that set of alternatives?

(rx (or bos bow (1+ blank))
    (or (seq (group
              ;; Group 1: full @-prefixed MXID.
              "@" (group
                   ;; Group 2: displayname.  (NOTE: Does not work
                   ;; with displaynames containing spaces.)
                   (1+ (seq (optional ".") alnum)))
              (optional ":" (1+ (seq (optional ".") alnum))))
             (or ":" eow eos (syntax punctuation)))
        (seq (group
              ;; Group 3: MXID username or displayname.
              (1+ (not blank)))
             ":" (1+ blank))))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions