zed icon indicating copy to clipboard operation
zed copied to clipboard

Unexpected wrap?

Open failable opened this issue 2 years ago • 11 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

def payload(slug, offset=0, length=15):
    return {
        "query": "query TagPageQuery($short: String, $slug: String!, $order: String, $offset: Int!, $length: Int!) {\n  locale(short: $short) {\n    tag(slug: $slug) {\n      cacheKey\n      id\n      slug\n      avatar\n      createdAt\n      updatedAt\n      redirectRelativeUrl\n      alternates {\n        cacheKey\n        short\n        domain\n        id\n        code\n        __typename\n      }\n      tagTranslates {\n        cacheKey\n        id\n        title\n        metaTitle\n        pageTitle\n        description\n        metaDescription\n        keywords\n        __typename\n      }\n      posts(order: $order, offset: $offset, length: $length) {\n        data {\n          cacheKey\n          id\n          slug\n          views\n          postTranslate {\n            cacheKey\n            id\n            title\n            avatar\n            published\n            publishedHumanFormat\n            leadText\n            author {\n              cacheKey\n              id\n              slug\n              authorTranslates {\n                cacheKey\n                id\n                name\n                __typename\n              }\n              __typename\n            }\n            __typename\n          }\n          category {\n            cacheKey\n            id\n            __typename\n          }\n          author {\n            cacheKey\n            id\n            slug\n            authorTranslates {\n              cacheKey\n              id\n              name\n              __typename\n            }\n            __typename\n          }\n          postBadge {\n            cacheKey\n            id\n            label\n            postBadgeTranslates {\n              cacheKey\n              id\n              title\n              __typename\n            }\n            __typename\n          }\n          showShares\n          showStats\n          __typename\n        }\n        postsCount\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}",
        "operationName": "TagPageQuery",
        "variables": {
            "slug": slug,
            "order": "postPublishedTime",
            "offset": offset,
            "length": length,
            "short": "en",
            "cacheTimeInMS": 300000,
        },
    }

If soft wrap is off, the text looks like (it wraps at about 500 chars)

image

In Emacs it looks like

image

If soft wrap is on, it looks like

image

Not sure if this is a bug...when soft wrap is off, why it looks like 'semi-soft wrap'?

Environment

Zed: v0.97.5 (preview) OS: macOS 13.2.1 Memory: 32 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

failable avatar Jul 30 '23 10:07 failable

UPDATE: Please disregard. Wrapping is functioning correctly. The problem was that my code had quotation marks around the 'true' value for newline which prevented the settings file from being parsed correctly. I’m leaving my comment here in case others have values in quotes (and shouldn't have).

Incorrect: "ensure_final_newline_on_save": “true”,

Correct: "ensure_final_newline_on_save": true,

<- My original comment ->

I don’t know if this is related but wrapping—at least with HTML files—seems not correct. My preferred line length settings are set to 80-characters with HTML specifically set as:

"languages": {
    "HTML": {
      "soft_wrap": "preferred_line_length"
    }
  }

Toggling soft wrap works but it seems to be at editor width not preferred line length. This is the case whether I specifically set the wrap behavior for HTML in my settings file or not.

fuzenco avatar Dec 16 '23 19:12 fuzenco

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed. Thanks for your help!

github-actions[bot] avatar Sep 24 '24 12:09 github-actions[bot]

Still happens in

Zed: v0.154.1 (Zed Preview)
OS: macOS 15.0.0
Memory: 32 GiB
Architecture: x86_64

failable avatar Sep 24 '24 14:09 failable

This appears fixed in Zed Preview 0.155.0. Thanks for following up on this issue.

fuzenco avatar Sep 27 '24 20:09 fuzenco

It still happens here

image
Zed: v0.155.1 (Zed Preview)
OS: macOS 15.0.0
Memory: 32 GiB
Architecture: x86_64

failable avatar Sep 28 '24 00:09 failable

I see. But my post was in reference to Markdown or plain text files. In those, the matter seems fixed.

fuzenco avatar Sep 28 '24 00:09 fuzenco

Seeing this issue in txt files as well (but more importantly for me, in log files).

avamsi avatar Nov 28 '24 04:11 avamsi

Seeing this issue in txt files as well (but more importantly for me, in log files).

Yes, I just encountered an instance this past week with a comma again but I can’t remember how I reproduced it.

fuzenco avatar Nov 28 '24 04:11 fuzenco

Screenshot 2024-11-29 at 10 53 58

Screenshot 2024-11-29 at 10 53 45

The issue is very easy to reproduce, in fact, when the text does not include spaces or other symbols (excluding whole word wrap), you'll find that with soft wrap turned off, there are only a maximum of 512 characters per line.

I believe this is intentional on Zed for issue https://github.com/zed-industries/zed/issues/834 and as a limit of MAX_LINE_LEN 512 in PR https://github.com/zed-industries/zed/pull/866.

This is make sense, but it makes inconvenient for Zed to work with some files such as logs or CSVs.

kliu avatar Nov 29 '24 03:11 kliu

@as-cii @nathansobo could you please reconsider this decision to wrap at a certain point no matter user settings? This is almost the only thing that I need to go back to VS Code for.

avamsi avatar Feb 14 '25 06:02 avamsi

This is make sense, but it makes inconvenient for Zed to work with some files such as logs or CSVs.

Agreed. In my case, I want to edit log files with very long lines and multi-cursor. Selecting part of the text and using "shift+end" does not actually select the end of the line (as defined by the next newline character) but instead only selects text until the soft-wrap.

IMO, with soft-wrapping off, Zed should simply not soft-wrap at all.

thomaseizinger avatar May 31 '25 00:05 thomaseizinger

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar Oct 01 '25 07:10 github-actions[bot]

The issue is relevant.

Zed wraps 513th character (column 514 in status bar) even with "soft_wrap": "none":

Screenshot Image

It's hardcoded:

  • https://github.com/zed-industries/zed/blob/v0.205.9/crates/editor/src/element.rs#L8438
  • https://github.com/zed-industries/zed/blob/v0.205.9/crates/editor/src/editor.rs#L221

but inconvenient for the reasons described above.

rmnilin avatar Oct 01 '25 07:10 rmnilin