carta icon indicating copy to clipboard operation
carta copied to clipboard

Cursor position is wrong when going down

Open cezaryszymanski opened this issue 9 months ago • 1 comments

Hello

I wanted to start using the lib, but I've noticed this bug: https://jam.dev/c/00b1b488-79e5-49b0-a0e1-cf6153e0ee6c

When going down in editor the cursor position becomes wrong. Answer in this issue https://github.com/BearToCode/carta/issues/83#issuecomment-2178378586 mentions using monospace font and it works, but it would be nice to have an actual fix to it

Reproduction: https://stackblitz.com/edit/carta-cursor-bug?file=src%2FApp.svelte

cezaryszymanski avatar Apr 23 '25 07:04 cezaryszymanski

Hi, from the docs you can see that the following is required:

<style>
	:global(.carta-font-code) {
		font-family: '...', monospace;
		font-size: 1.1rem;
		line-height: 1.1rem;
		letter-spacing: normal;
	}
</style>

I think that without a monospace font, some things might break, but it should work almost fine. But without the other settings the cursor won't be aligned, as shown in your video.

BearToCode avatar Apr 24 '25 06:04 BearToCode