Hitting ctrl + A on a Mac moves the cursor to the beginning of a line and hitting ctrl + E moves the cursor to end of the line, regardless of whether that line is wrapped onto subsequent lines. The yellow lines show where the cursor is moved to.
I agree this is annoying behavior! (RStudio also has Control-A and Control-E mapped to "Go to beginning/end of line" by default, and the same thing occurs). If you want to suggest this as a feature request, here's the guide for how to do so: Writing Good Feature Requests · rstudio/rstudio Wiki · GitHub
The current behavior seems to interact with soft-wrapping — in situations where the editor contents are soft-wrapped, "Go to beginning/end of line" actually goes to the previous/next wrap point. When you have soft-wrapping turned off, it does properly go to the beginning/end of the line (as indicated by the line numbers). I can understand the logic behind making the "end" of the line the wrap point when lines are soft-wrapped, but I find it is rarely what I actually want to do. FWIW, the MacOS shortcuts are officially described as "Move to the beginning/end of a line or paragraph".
Examples:
R script, no soft-wrapping
Control-E goes to end of line:
R script, soft-wrapping turned on in Global Options
Control-E goes to end of wrapped line (but see cursor position box in lower left: not actually the end of the line)
Text file, always soft-wraps
Control-E goes to end of wrapped line (but see cursor position box in lower left: not actually the end of the line)