You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
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.
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)
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).
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:
Do you agree with my last assertion (e.g. indenting should be only a visual effect)?
Is there anyway to position a tokenized line arbitrarily (or in a way that could fit our purpose, e.g. renderFromColumn: 2)?
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).
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 🙏
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.
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!
Activity
bobrocke commentedon Jun 8, 2014
This one looks dead. Were there any solutions?
cameronmcefee commentedon Jun 8, 2014
I believe this has been resolved.
cameronmcefee commentedon Jun 8, 2014
Mm, nope, sorry. Still a thing.
kelhusseiny commentedon Jun 28, 2014
@cameronmcefee Did you fix this issue? I still can not solve this!
cameronmcefee commentedon Jun 28, 2014
@Azzurrio Sorry, I'm not working on this issue, I just reported it.
trevordmiller commentedon Aug 2, 2014
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.
jescalan commentedon Aug 6, 2014
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)
Here's what the code actually looks like:
jeffreylees commentedon Aug 19, 2014
+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.
lokarlhorst commentedon Aug 26, 2014
+1 Please fix it...it's annoying
crazymykl commentedon Aug 26, 2014
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).
wanderingcrow commentedon Sep 3, 2014
Atom looks awesome, but this is a deal breaker for me. Is there any movement on this?
29 remaining items
joshrowley commentedon Feb 8, 2015
+1, just showing my support for this, great work team!
as-cii commentedon Feb 13, 2015
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 oneTokenizedLineinto 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
TokenizedLineaccepts anindentLevelparameter 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 inTokenizedLine’s tokens or text.Now, a couple of questions:
renderFromColumn: 2)?rightFragments (which would contain as many spaces asleftFragment’s indentation). Ideally this shouldn't be selectable and the cursor should refuse to lie on it (displayBuffer#clipScreenPositionmay handle this).Thanks in advance to anybody who will help me out 🙏
thedaniel commentedon Feb 13, 2015
Pinging @atom/core re @as-cli's questions
nathansobo commentedon Feb 14, 2015
Yes, but we model it. The
DisplayBufferis responsible for the non-linear relationship between lines/characters on screen and lines/characters in the buffer, dealing with folds and soft-wraps.No, you're going to need to insert a phantom token. More details below.
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.
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.
Josiah commentedon Feb 26, 2015
🏆 Awesome - really wanted this feature!
lock commentedon Jan 22, 2019
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!