firepad icon indicating copy to clipboard operation
firepad copied to clipboard

Character  (E000) on each new line visible when TextMarkers are added and then removed on editor change

Open knod opened this issue 9 years ago • 3 comments

Version info

Firebase: v3.6.0

Firepad: 1.4.0

Ace:

CodeMirror: 5.20.2

Other (e.g. Node, browser, operating system) (if applicable): OSX 10.11, Chrome 54.0.2840.98

Test case

https://jsfiddle.net/ssc5q7j7/ (works even if you don't put in your own app config details)

Steps to reproduce

Type in the second line, press enter, type in the third line. Note: I believe that editor.on('change'...) is important. This issue only happens if the marks are removed in editor.on('change'...) as far as I can tell. If you put the mark removal after the mark creation in firepad.on('ready'...) I don't think you get the same behavior.

Expected behavior

When text is written, it should appear with no extraneous characters/symbols. Also, text copied from Firepad and pasted into, for example, Sublime Text should not have extraneous symbols.

Actual behavior

For me, squares (the symbol E000, I've discovered) appear at the beginnings of the second and third lines - the lines that have a newline preceding them and that have had marks removed on the "change" event. These symbols go away if you manipulate the breaks between the lines or delete them. Also, when I copy from Firepad and paste into Sublime Text, these symbols are on each line. If I copy plain text into the Firepad editor, these symbols won't appear on the pasted lines at the next copy and paste into Sublime, but if I press enter anywhere in the Firepad, copying and pasting will reveal these symbols in the newly created lines.

knod avatar Dec 03 '16 13:12 knod

I did search Firepad's repo and found where the symbol is created (as well as it's creation through css). It seems like it's being used as a marker or a hook for certain operations. I'm still not sure why it would become visible under these circumstances or how to prevent that.

I found this issue that discusses some copy/paste issues and sentinel characters are mentioned. By the end something seems to be solved, but maybe that was a solution for speed issues as opposed to sentinel character issues.

knod avatar Dec 03 '16 14:12 knod

If you comment the richTextShortcuts line, it works fine.

var firepad = Firepad.fromCodeMirror(
	dbRef.child( 'test' ),
	editor,
	{
		//richTextShortcuts: true,
		richTextToolbar: true
`})

mercebc avatar Dec 07 '16 09:12 mercebc

@mercebc: Won't that disable keyboard shortcuts for rich text features? If so, that's not something I want to do and it's something that seems like not expected behavior.

knod avatar Dec 10 '16 13:12 knod