• Resolved Imagekfomichev

    (@kfomichev)


    I’m editing a snippet, as usual. This is a piece of code to reproduce the problem. The code itself doesn’t make much sense, I just stripped off everything that doesn’t affect the problem.

    To reproduce make an empty snippet and paste this code

    r.html('<path d=\"M198 0a66 66 0 0 1-87 6

    If you type any digit after the last ‘6’ then something weirdly breaks, a part of the code gets hidden, the cursor can’t be precisely controlled anymore. When editing real code, it’s very annoying. The code stays intact somewhere in the editor’s internals, and can even be copied and pasted to another application (like wordpad). But it is not displayed correctly and can’t be edited anymore, until last change is reverted by Ctrl-Z.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor ImageCarolina

    (@carolinaop)

    Hello @kfomichev,

    Thank you for reporting the issue.

    This behavior occurs because CodeMirror—the editor used by Code Snippets—struggles with very long single-line strings, such as SVG path data, like the code you shared. When additional digits are added after the “6,” on the long SVG code, the line becomes too long for the editor to render properly, which causes part of the code to be hidden and makes the cursor behave incorrectly.

    The code itself is not corrupted and can still be copied correctly. As a simple workaround, you can break the long SVG path string into smaller segments or multiple lines within your snippet. This prevents the editor from reaching its rendering limits.

    Best regards,

    Carolina

    Thread Starter Imagekfomichev

    (@kfomichev)

    Dear Carolina! You’re right, It all began with a pretty long SVG path. And yes, I tried to split it. But the provided piece (in the first message) is only 41 characters long. This piece alone, without any additional lines, is enough to reproduce the problem.

    Actually, it WAS. Today I can’t reproduce the problem anymore… Feel stupid now 🙁

    Plugin Contributor ImageCarolina

    (@carolinaop)

    Hello @kfomichev, thank you so much for your feedback!

    I’m really glad to hear that the issue seems to have resolved itself — please don’t feel bad at all, these things happen 🙂

    Let us know if you need anything further!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.