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

Regex formatters don't track position #580

Closed
jcubic opened this issue May 27, 2020 · 1 comment
Closed

Regex formatters don't track position #580

jcubic opened this issue May 27, 2020 · 1 comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@jcubic
Copy link
Owner

jcubic commented May 27, 2020

Issue summary

Simple regex formatters don't handle position, so it work like it in fact change the position (you can't move the cursor inside replaced text).

Expected behavior

You should move the cursor on text created using regex formatter

Actual behavior

you can click on first character of the replaced text

Steps to reproduce

  1. Execute:
 $.terminal.new_formatter([
     /foo/g, '[[;green;]foo]'
 ]);
 $.terminal.new_formatter(function(str, options) {
     return [str.replace(/bar/g, '[[;green;]bar]'), options.position];
 });
 term.insert('foo bar');
  1. you can only click o letter "f" in foo but on any character in bar
@jcubic jcubic added the Bug label May 27, 2020
@jcubic
Copy link
Owner Author

jcubic commented May 31, 2020

The problem is more complex it don't work if there are two formatters and one change the length of the string.

jcubic added a commit that referenced this issue May 31, 2020
Problem was if one formatter change length of the text and even if the cursor position
was outsite of the length changing formatter it looked like safe formatter
changed length because you could not click inside replaced text
@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label May 31, 2020
@jcubic jcubic closed this as completed May 31, 2020
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