Grey horizontal line in editor
Show older comments
Hi All,
I changed a battery in the keyboard, there was some button mashing and now I have a thin grey horizontal line where my code can be wrapped i.e. wherever %% occurs, directly above it. It turns blue when I am editing code therein. How do I turn it off? For those tempted to ask, yes i spent a lot of time in the preferences interface looking for the setting. I looked in the forum, someone asked this question and the solution was to turn off code wrapping, I want the wrapping, just not the grey line. (Previous question: https://au.mathworks.com/matlabcentral/answers/245035-how-to-make-comments-not-wrap)
This is not Preferences > editor/debugger/display > "show line"
Thanks!

Answers (2)
%% creates a section break, which is something that can make certain work easier or more modular.
In older versions, this was referred to as "Cell Mode"
8 Comments
matthew schwarz
on 25 Dec 2022
Edited: matthew schwarz
on 25 Dec 2022
Oh. Sorry about that.
Since I run older versions, I'm used to there always being a gray line there, but it's a bit thinner and doesn't extend all the way to the left. I'm not sure how the section breaks look in R2022b. I know the editor appearance has changed, so I'm not sure what to make of the screenshot. Could it be that you accidentally keymash-enabled some sort of debugger feature?
matthew schwarz
on 25 Dec 2022
Image Analyst
on 25 Dec 2022
@matthew schwarz you keep forgetting to attach a screenshot so we can see what you're talking about. There is no "photo below" like you said.
matthew schwarz
on 25 Dec 2022
Matt J
on 25 Dec 2022
I'm quite sure i've keymash-enabled 'something', just have no idea what it is!
The better question is, how did you disable it in the first place? Everything you describe seems to be default behavior.
Are you sure you didn't accidentally launch a newer version of Matlab that you weren't working in previously?
In R2019b, sections look like this:

As of R2021b, I thought the sections were supposed to look different. There is no longer a yellow fill color, and the section is highlighted only by changing the top and LHS bars to blue. I don't even see a LHS bar in your screenshot, so I don't know if that's messed up or if they just removed that in R2022x.

As far as whether that behavior can be customized/reverted, I don't think so, but I know there's plenty of people who would want it.
See also:
matthew schwarz
on 26 Dec 2022
Image Analyst
on 25 Dec 2022
Edited: Image Analyst
on 25 Dec 2022
0 votes
The wrapping gray line is a vertical line, not a horizontal line.
See (in r2022b)
Home->Preferences->Editor/Debugger->Display->Right hand text limit->Show Line.
or
Home->Preferences->Editor/Debugger->Language->Comment formatting->Wrap comments automatically while typing.
I don't like autowrapping so I usually set the column really high, like 200 and tell it not to show the line or wrap.
4 Comments
matthew schwarz
on 25 Dec 2022
Image Analyst
on 25 Dec 2022
Edited: Image Analyst
on 25 Dec 2022
I thought I used to be able to turn off the horizontal line above sections by unchecking the checkboxes in
Home->Preferences->Editor/Debugger->Autoformatting->Section break
but that no longer seems to be the case with r2022b. If I put %% to start a new section, it always puts the horizontal line in there regardless of the state of the checkboxes. I think this may be a bug, unless I'm just not understanding something.
Wherever the cursor / active line is, the lines above and below that section will be blue, and for other sections that I'm not in the lines will be gray.
matthew schwarz
on 25 Dec 2022
Image Analyst
on 25 Dec 2022
I'm not sure why you call that "wrapping." Basically it's an indicator for a section. Sections are blocks of code that can be run as a unit. They are distinguished from adjacent sections by the horizontal lines. The entire section gets run with one click, unlike the normal one-line-at-a-time Step button. There are special Run buttons to the left of the normal Run button on the tool ribbon to deal with different ways to run a section.
If you don't want sections you can get rid of comment lines starting with %%. I don't like to run sections so when I get code from Answers that has %% I just do a global replacement of %% with %.
Not sure if
- you don't want any lines separating your section at all, or
- you just want them all the same color (gray or blue), or
- you want the dividing lines to all be in a certain custom color, or
- you only want lines bordering the particular section you're currently in.
Anyway, for any case, I don't know how to turn the section divider lines off other than to not have sections at all by deleting the double %.
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!