rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.59k stars 1.08k forks source link

Fix keyboard shortcut routing with Visual Editor in source columns and secondary windows #14673

Closed gtritchie closed 1 month ago

gtritchie commented 1 month ago

Intent

Addresses:

Approach

Lots of debugging, breakpoints, imaginary hair-pulling, etc. to figure out what was NOT happening with Visual Editor receiving focus vs. regular source editor.

As expected, some events/notifications weren't being triggered when the Visual Editor received focus. These didn't matter when only one document was visible at a time, but their absence prevented keyboard shortcuts from being routed correctly with multiple visible editors via source columns and/or secondary windows.

The fix has to deal with the Visual Editor receiving focus via a code chunk or non-code region of the document.

Automated Tests

Not yet; I'm working on that next. These aren't regressions (I tried back to v2022.07.2, and these issues repro'd), so I'm not waiting on automation before merging this.

QA Notes

Try the steps in the issues.

In addition to testing running chunks via keyboard shortcuts, try others such as Save File (Cmd+S) and confirm they are now acting on the correct document.

Note that switching to source mode and then back to visual mode can temporarily fix this problem (source mode fires the events that Visual Mode didn't).

Another thing to vary when testing is focusing a Visual Editor instance by clicking on a code chunk vs. non-code as those trigger different code paths.

Documentation

NA

Checklist