Marktext: Text inserted at wrong position - not at cursor

Created on 31 Aug 2018  路  2Comments  路  Source: marktext/marktext

I am getting some strange issues with the insertion point getting wrongly positioned. It seems to happen after I have done some complex editing operations, The program gets confused about where to insert new text.

For example, you put the cursor on one line and the text that you type is inserted several lines above it. Switching to 'Source code mode' and back doesn't fix it.

I will try to capture a sample file that illustrates the issue. So far it occurs intermittently and is difficult to pin down. Has anyone else noticed this?

resolvefixed but not released 馃悰 bug

Most helpful comment

I have done some testing and got a better handle on this. Please use the attached file baddoc6.txt

Steps to reproduce

Open a new document in Mark Text
Paste in the text from baddoc6.txt
Put the cursor in the middle of the word 'Introduction' and press return.

What you expect

Wordpress Templates
1 Intro
duction

What you see

The return has been inserted, but the two parts have been swapped round.

Wordpress Templates
duction
1 Intro

In fact the whole document is really messed up and exhibilts various odd behaviours. Putting the cursor in the middle of any paragraph and typing return causes the paragraphs to be swapped around and the cursor to jump to different places.

It seems to be connected with the line endings. I'm on Windows and the text file has single spacing using CR LF. When I posted originally the results were very confusing. My document got badly corrupted when I tried to paste in multiple paragraphs.

All 2 comments

I have done some testing and got a better handle on this. Please use the attached file baddoc6.txt

Steps to reproduce

Open a new document in Mark Text
Paste in the text from baddoc6.txt
Put the cursor in the middle of the word 'Introduction' and press return.

What you expect

Wordpress Templates
1 Intro
duction

What you see

The return has been inserted, but the two parts have been swapped round.

Wordpress Templates
duction
1 Intro

In fact the whole document is really messed up and exhibilts various odd behaviours. Putting the cursor in the middle of any paragraph and typing return causes the paragraphs to be swapped around and the cursor to jump to different places.

It seems to be connected with the line endings. I'm on Windows and the text file has single spacing using CR LF. When I posted originally the results were very confusing. My document got badly corrupted when I tried to paste in multiple paragraphs.

Thanks @tenbob, this is indeed a problem and also with soft line breaks (two spaces at the end of the line). At first I thought it was just a markdown parser failure because your given markdown file is not compatible with GFM and CommonMark (missing new line between text blocks) but it seems rather a problem with the HTML/markdown converter (importMarkdown.js and/or exportMarkdown.js) or enter controller (enterCtrl.js) because the new line is inserted at the wrong position.

Minimal example:

Copy and paste the following text into source code and switch into preview mode.

foo
ba<CURSOR>r
baz

Press return key and switch into source code mode - whereas <CURSOR> is the cursor position.

foo
r
ba

baz

You will notice the new line between ba and baz.

It seems to be connected with the line endings.

I don't think so, see above and I can reproduce it on Linux.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stefnotch picture stefnotch  路  4Comments

davidmichaelhuber picture davidmichaelhuber  路  3Comments

N0rbert picture N0rbert  路  4Comments

jrobbins picture jrobbins  路  3Comments

1dancook picture 1dancook  路  4Comments