Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Softwrap should match indent #1125

Closed

Description

@cameronmcefee

Ok, this one may be a personal preference, but it drives me nuts that softwrap doesn't match the indent.

screen shot 2013-11-18 at 5 18 17 pm

Activity

  1. bobrocke commented on Jun 8, 2014

    @bobrocke

    This one looks dead. Were there any solutions?

  2. cameronmcefee commented on Jun 8, 2014

    @cameronmcefee
    Author

    I believe this has been resolved.

  3. cameronmcefee commented on Jun 8, 2014

    @cameronmcefee
    Author

    Mm, nope, sorry. Still a thing.

  4. kelhusseiny commented on Jun 28, 2014

    @kelhusseiny

    @cameronmcefee Did you fix this issue? I still can not solve this!

  5. cameronmcefee commented on Jun 28, 2014

    @cameronmcefee
    Author

    @Azzurrio Sorry, I'm not working on this issue, I just reported it.

  6. trevordmiller commented on Aug 2, 2014

    @trevordmiller

    Would greatly appreciate this being added as an option or as the default wrapping functionality. Having wrapped lines start back at the far left is confusing because it doesn't keep the indent level of the line that belongs to which throws off the entire file structure.

  7. self-assigned this
    on Aug 5, 2014
  8. jescalan commented on Aug 6, 2014

    @jescalan

    Just ran into this today as well. This is super confusing to deal with when you run into it. It essentially drop any indentation as soon as a line is soft wrapped, but still keeps the indent on the next line. But this only happens visually, technically the code works fine (ran into this with a whitespace significant language and although it looked messed up it compiled correctly. An example (this one is jade)

    screen shot 2014-08-06 at 12 27 32 pm

    Here's what the code actually looks like:

    .some_div
      a(href='http://www.areallyreallyreallyreallyreallyreallyreallyreallylonglink.com')
      .another_div
    
  9. jeffreylees commented on Aug 19, 2014

    @jeffreylees

    +1 This is the only thing really stopping me from moving over full time, it's driving me nuts. Such a small thing, but yeah.

  10. lokarlhorst commented on Aug 26, 2014

    @lokarlhorst

    +1 Please fix it...it's annoying

  11. crazymykl commented on Aug 26, 2014

    @crazymykl

    Although I am very much for this feature, and would have it turned on, a co-worker of mine has expressed disdain for it. Therefore, it'd be best if it were optional (but probably on by default).

  12. wanderingcrow commented on Sep 3, 2014

    @wanderingcrow

    Atom looks awesome, but this is a deal breaker for me. Is there any movement on this?

  13. 29 remaining items

  14. joshrowley commented on Feb 8, 2015

    @joshrowley

    +1, just showing my support for this, great work team!

  15. as-cii commented on Feb 13, 2015

    @as-cii
    Contributor

    I would like to tackle this (or, at least, offer my help), but I need guidance in order to get started. This should affect only rendering, therefore my understanding of the code led me to TokenizedLine.

    In particular, softWrapAt(column) contains the code which converts one TokenizedLine into a left fragment (the line which will fit the current row) and a right fragment (the line which, probably, needs further splitting because it doesn’t fit the current line). The process repeats until no overflowing characters are found.

    I have noticed also that TokenizedLine accepts an indentLevel parameter which, unfortunately, doesn’t have any effect on the resulting rendering (I assume this is why the issue hasn’t been solved yet, otherwise it would have been too simple 😉).

    Thus, as far as I understand, we would need a way to move the rightFragments towards right. However, this should be just a visual effect: even though my knowledge of the codebase is relatively limited, I’d say this change should not involve any modification in TokenizedLine’s tokens or text.

    Now, a couple of questions:

    1. Do you agree with my last assertion (e.g. indenting should be only a visual effect)?
    2. Is there anyway to position a tokenized line arbitrarily (or in a way that could fit our purpose, e.g. renderFromColumn: 2)?
    3. If we treat this just as a rendering issue, though, we couldn't be able to wrap lines correctly (e.g. if we indent the lines next to the first one, those lines will have less space and thus they should wrap earlier). An alternative could be to place a “fake” (read: special) token in front of the rightFragments (which would contain as many spaces as leftFragment’s indentation). Ideally this shouldn't be selectable and the cursor should refuse to lie on it (displayBuffer#clipScreenPosition may handle this).
    4. Is there any other pitfall which I am totally ignoring and that causes this to be tricky?

    Thanks in advance to anybody who will help me out 🙏

  16. thedaniel commented on Feb 13, 2015

    @thedaniel
    Contributor

    Pinging @atom/core re @as-cli's questions

  17. nathansobo commented on Feb 14, 2015

    @nathansobo
    Contributor

    Do you agree with my last assertion (e.g. indenting should be only a visual effect)?

    Yes, but we model it. The DisplayBuffer is responsible for the non-linear relationship between lines/characters on screen and lines/characters in the buffer, dealing with folds and soft-wraps.

    Is there anyway to position a tokenized line arbitrarily (or in a way that could fit our purpose, e.g. renderFromColumn: 2)?

    No, you're going to need to insert a phantom token. More details below.

    An alternative could be to place a “fake” (read: special) token in front of the rightFragments (which would contain as many spaces as leftFragment’s indentation).

    Check out how we handle hard tab characters, which map multiple spaces in screen coordinates to a single character in the buffer. This should be similar, but would map to zero characters in the buffer causing the cursor to skip that leading whitespace.

    Is there any other pitfall which I am totally ignoring and that causes this to be tricky?

    I think your phantom token approach sounds promising and was what I had in mind. It's hard to say what kind of issues might crop up with our coordinate mapping going from multiple characters on screen to zero in the buffer since we've never done that... with tab we map to one character in the buffer. So that could be interesting. You'll just have to see what emerges I guess.

  18. Josiah commented on Feb 26, 2015

    @Josiah

    🏆 Awesome - really wanted this feature!

  19. lock commented on Jan 22, 2019

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  20. locked as resolved and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions