Editor highlighting line break when hitting return
古いコメントを表示
Hi,
I have been working with this problem for a few years. I have not found a solution and I cannot get used to it.
Here is what happens...
- I want to insert a new line of text in the middle of a script.
- I place the cursor at the end of a line.
- I hit return to create a new line.
- Matlab inexplicably selects the line break.
- When I start typing the line break is overwritten.
- The new text goes at the end of the old line, instead of at the beginning the new line.
- This problem happens intermittently.
This never used to be an issue, but it has been a persistent annoyance for the last couple of years. I have tried looking for a solution, but I have yet to find one that works.
I am currently using Matlab R2024a Update 1 on a Mac Studio Apple M1 Ultra running Sequoia 15.5
Please help!
thanks,
Ben
8 件のコメント
dpb
2025 年 6 月 20 日
"I place the cursor at the end of a line"
How, specifically, do you reach the end of the line? Does it do it if you use "End" key rather than mouse?
Ben Ward
2025 年 6 月 23 日
dpb
2025 年 6 月 23 日
I'd suggest submitting a bug report on the behavior with the precise hardware and software configuration--it's always possible there's something weird in a particular piece of gear or version. Mathworks would likely have to be able to recreate the setup in order to have any chance at all of finding out what might be different there.
Ben Ward
2025 年 6 月 24 日
dpb
2025 年 6 月 24 日
Or, it's always possible there's something funky with your particular one of these mouses...no chance to try another one of them, I suppose, is there?
Ben Ward
2025 年 6 月 25 日
dpb
2025 年 6 月 25 日
Oh, another thought. Have you tried updating a driver for the particular hardware? Maybe there's a fix there for a known issue...
採用された回答
その他の回答 (1 件)
Ruchika Parag
2025 年 6 月 25 日
Hi @Ben Ward, based on your description, it seems like there may be a UI behavior issue in the MATLAB Editor, possibly related to macOS input handling or preferences.
Here are a few things you can try:
1. Check Editor Preferences
Sometimes aggressive auto-formatting or indentation settings can cause unexpected behavior.
- Go to Home > Preferences > Editor/Debugger > Language.
- Try disabling Smart Indentation, Auto Formatting, and any related options.
- Restart MATLAB and test again.
2. Disable macOS Press-and-Hold Behavior
macOS includes a feature that can interfere with how some keys (like Return) behave in applications. You can disable it with this terminal command:
defaults write -g ApplePressAndHoldEnabled -bool false
After running the command, restart MATLAB (and possibly the system) to apply the change.
Hope this helps!
カテゴリ
ヘルプ センター および File Exchange で Programming Utilities についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!