Weird question about the editor...
Mostrar comentarios más antiguos
So this might be insanely daft of me to ask...
But most of my code writing takes place in the editor. When writing code/copy pasting stuff into a code comment I can't help but notice that thin line that runs veritcally down in the editor, over about 1/3 of the total lenth of the screen to the right of the code. What is this line? Why does it sometimes word-wrap my comments when it touches the line, and sometimes doesnt? Just a curious cat meowing into the midnight under the moonlight.
8 comentarios
"What is this line?"
Aaaaaaah, to understand that right-hand text limit (as it is called in the MATLAB settings) you have to delve into the history of computers. In short, it is because a long time ago computers could only hold/process/print a limited number of characters per line (limited by various technologies):
You can find more detailed history of this line online.
Programmers hold onto that line like a kind of comfort blanket, even though any technical neccessity it might once have had has been irrelevant for more than half a century. Feel free to ignore the line if you want (or change its placement in the settings), with the understanding that programmers are very delicate creatures and are easily surprised by small changes in what they see (in your code, in other languages, etc) and will let you know that you are doing something very very wrong... but are not really able to state exactly what.
Perhaps some of them will reply here.
Spaceman
el 10 de Mzo. de 2024
Stephen23
el 10 de Mzo. de 2024
"What do you have yours set to, by chance?"
The default... and I ignore it whenever I wish to.
The modern argument in favor of such a limit is that code lines above a certain length are harder for humans to parse and understand (and hence increase risk of bugs, etc). There is a certain truth to this, but in my experience that length depends highly on the content of that line, the content of adjacent lines, what kind of syntax is being used, etc. Thus out of many years practice I learn to use that limit as a guide but have no qualms about having shorter/longer lines when the context makes that an aesthetically better decision.
Spaceman
el 14 de Mzo. de 2024
DGM
el 14 de Mzo. de 2024
Why wait for the cat to step on the keyboard when you can let your IDE spontaneously slap a newline in the middle of what you're typing? With our advanced settings, the right-hand text limit is no longer just a mostly useless distraction, it can now double as a recurring nuisance! Brilliant!
I disabled everything related to the text limit.
Spaceman
el 21 de Mzo. de 2024
DGM
el 21 de Mzo. de 2024
To be fair, I've changed my formatting style a number of times over the years, but I never fail to think that I've got it nailed down tight. It's almost like I don't know what I'm doing. :)
Spaceman
el 8 de Abr. de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!