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

wrap with abbreviation not working as expected in macros #153

Open
old9 opened this issue Jan 23, 2021 · 0 comments
Open

wrap with abbreviation not working as expected in macros #153

old9 opened this issue Jan 23, 2021 · 0 comments

Comments

@old9
Copy link

old9 commented Jan 23, 2021

When recorded and then played back in a macro, wrap with abbreviation reports an error in the console:

'EmmetWrapWithAbbreviation' object has no attribute 'wrap_entries'

It seem that some logic like this is missing in the def run block:

sublime-text-plugin/main.py

Lines 355 to 379 in 843b50e

view = self.view
abbreviation.stop_tracking(view)
wrap_entries = []
wrap_size = 0
for sel in list(self.view.sel()):
config = wrap.get_wrap_config(view, sel.begin())
region = wrap.get_wrap_region(view, sel, config)
lines = wrap.get_content(view, region, True)
config.user_config['text'] = lines
wrap_size += len(region)
wrap_entries.append((region, config))
# Check for region overlapping
self.wrap_entries = []
wrap_entries.sort(key=lambda item: item[0].begin())
for entry in wrap_entries:
prev = self.wrap_entries[-1] if self.wrap_entries else None
if prev and prev[0].intersects(entry[0]):
prev[0] = prev[0].cover(entry[0])
else:
self.wrap_entries.append(entry)

When emmet_wrap_with_abbreviation is directly called from within a macro, wrap_entries is undefined then.

And since wrap_entries is always picked from the state of last widget input, it may also lead to other unexpected results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant