Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong cursor position with Prism and unix formatting #533

Closed
jcubic opened this issue Oct 25, 2019 · 1 comment
Closed

Wrong cursor position with Prism and unix formatting #533

jcubic opened this issue Oct 25, 2019 · 1 comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@jcubic
Copy link
Owner

jcubic commented Oct 25, 2019

This is really edge case, with latest devel version (that fixed prism) if you have prism and unix_formatting and you have string of text with formatting inside (as html entities, like when you show source code of terminal code) cursor position is wrong when you click on the text inside.

Removing unix_formatting fixes the issue.

Expected behavior

prism work with unix formatting if source code have formatting as html entites inside string.

Actual behavior

You can't click on the text inside formatting inside string.

Steps to reproduce

  • include both scripts and run:
$.terminal.syntax('javascript');
term.insert(`
$.terminal.defaults.formatters.push(function(string) {
   return string.replace(/([^\`]|^)\`([^\`]+)\`([^\`]|$)/g, '$1[[b;#fff;]$2]$3')
});
`.trim());
@jcubic
Copy link
Owner Author

jcubic commented Oct 25, 2019

It seems that the problem can be resolved with proper ordering of formatters. prism need to be first formatter if used with unix_formatter:

term_formatters

var t = $.terminal.defaults.formatters;
$.terminal.defaults.formatters = [t[2], t[0], t[1], t[3]]

Maybe unix_formatting can be fixed so this ordering is not needed.

@jcubic jcubic added the Bug label Oct 25, 2019
@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Oct 26, 2019
@jcubic jcubic closed this as completed Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

1 participant