[BUG] codemirror dispatch insertions causes unnecessary scrolling

Steps to reproduce

using editor extension:

			keymap.of([{
				key: "a",
				run: (view) => {
					const pos = view.state.selection.main.head;
					view.dispatch({
						changes: {from: pos, to: pos, insert: "("},
					})
					return true
				}
			}])

have font size >=17
in a math block at the top of the screen and press a at the beginning of the line like

$$
|
$$

where | is the cursor and there lots of lines before and after and when its near the top of the screen.
for video see here or the original issue.

Did you follow the troubleshooting guide? [Y/N]

Please, follow the Troubleshooting Guide before answering Yes.
Yes

Expected result

It doesn’t change the scrollview/viewport

Actual result

the viewport/scrollview bounces up

Environment

SYSTEM INFO:
	Obsidian version: 1.13.4
	Installer version: 1.12.4
	Operating system: Windows 10 Home 10.0.19045
	Login status: logged in
	Language: en-GB
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 26
	Plugins enabled: 2
		1: Hot Reload v0.1.13
		2: Latex Suite v1.11.5

Additional information

edit: the above extension only works at the beginning of the line

keymap.of([{
	key: "a",
	run: (view) => {
		const pos = view.state.selection.main.head;
		const selection = view.state.selection
		const changes = ChangeSet.of(
			[{ from: pos, to: pos, insert: ")" }],
			view.state.doc.length,
		);
		view.dispatch({changes})
		const undoChanges = changes.invert(view.state.doc);
		const changes2 = undoChanges.compose(
			ChangeSet.of(
				[{ from: pos, to: pos, insert: "()" }],
				undoChanges.newLength,
			),
		);
		const newSelection = selection.map(changes,1).map(changes2, 1);
		view.dispatch({
			changes: changes2,
			selection: newSelection,
		})
		return true
	}
])

works just like the example but it’s a bit more convoluted/large mwe.