Editor highlighting line break when hitting return

조회 수: 6 (최근 30일)
Ben Ward
Ben Ward 2025년 6월 20일
댓글: Ben Ward 2025년 7월 14일
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
Ben Ward
Ben Ward 2025년 6월 25일
Thanks, I will try this.
dpb
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...

댓글을 달려면 로그인하십시오.

채택된 답변

K.
K. 2025년 7월 11일
I was able to reproduce this with a Magic Mouse in R2025a and have reported the issue to the appropriate person within MathWorks. I have also referred them to this page in case they have any information to share.
  댓글 수: 2
dpb
dpb 2025년 7월 11일
Kewl! to know it was/is reproducible. Be interesting to learn if it is actually a code defect or something non-conformant in the mouse firmware...
Ben Ward
Ben Ward 2025년 7월 14일
Great that you were able to reproduce this. Thanks for looking into it.
Ben

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ruchika Parag
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!
  댓글 수: 2
Ben Ward
Ben Ward 2025년 6월 25일
이동: Walter Roberson 2025년 7월 11일
This did not fix it, so I will try @dpb's suggestion of swapping out the magic mouse.
Ben Ward
Ben Ward 2025년 7월 14일
Thanks all.
Unfortunately none of the suggestions worked.
all the best,
Ben

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming Utilities에 대해 자세히 알아보기

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by