Grey horizontal line in editor

65 次查看(过去 30 天)
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!

回答(2 个)

DGM
DGM 2022-12-25
编辑:DGM 2022-12-25
%% 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 个评论
DGM
DGM 2022-12-25
编辑:DGM 2022-12-25
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
matthew schwarz 2022-12-26
RE Opened old version > no i always do a clean install when updating (i've accidently opened old versions before).
Ok so maybe i just havn't noticed it until now and it is a feture that isn't turn-off able. :/
RE link you posted > i saw that thread thanks.

请先登录,再进行评论。


Image Analyst
Image Analyst 2022-12-25
编辑:Image Analyst 2022-12-25
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.
If you're seeing a horizontal line then it's probably what @DGM said.
  4 个评论
matthew schwarz
matthew schwarz 2022-12-25
Yep! That's what i've found. It's quite annoying!
Image Analyst
Image Analyst 2022-12-25
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
  1. you don't want any lines separating your section at all, or
  2. you just want them all the same color (gray or blue), or
  3. you want the dividing lines to all be in a certain custom color, or
  4. 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 %.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Entering Commands 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by