Skip to content

Commit

Permalink
Set read only false before removing unsupported escape codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
matt1003 committed Mar 15, 2016
1 parent 9af42ed commit 94f6fc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def run(self, edit):

if not v.settings().has("ansi_scratch"):
v.settings().set("ansi_scratch", v.is_scratch())
v.set_scratch(True)

if not v.settings().has("ansi_read_only"):
v.settings().set("ansi_read_only", v.is_read_only())
v.set_read_only(False)

# removing unsupported ansi escape codes before going forward: 2m 4m 5m 7m 8m
ansi_unsupported_codes = v.find_all(r'(\x1b\[(0;)?(2|4|5|7|8)m)')
Expand All @@ -45,8 +47,6 @@ def run(self, edit):
# removing the rest of ansi escape codes
ansi_codes = v.find_all(r'(\x1b\[[\d;]*m){1,}')
ansi_codes.reverse()
v.set_scratch(True)
v.set_read_only(False)
for r in ansi_codes:
v.erase(edit, r)
v.set_read_only(True)
Expand Down

0 comments on commit 94f6fc3

Please sign in to comment.