Skip to content

wrap with abbreviation not working as expected in macros #153

@old9

Description

@old9

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions