diff --git a/mode/perl.py b/mode/perl.py index 4bcea25..76b35cd 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -573,11 +573,6 @@ class PerlWrapParagraph(WrapParagraph): margin = 80 comment_re = re.compile('( *)(#+)( *)(.*)') - def _is_newline(self, t): - return t.name == 'eol' - def _is_space(self, t): - return t.name == 'spaces' - def _detect_line_type(self, w, y): h = w.buffer.highlights[w.mode.name] ltype = None @@ -585,20 +580,13 @@ class PerlWrapParagraph(WrapParagraph): fqname = t.fqname() if fqname == 'spaces' or fqname == 'eol': pass - elif fqname.startswith('comment'): - if ltype and ltype != 'comment': - ltype = None - break - ltype = self.LT_COMMENT - elif fqname.startswith('pod'): - if ltype and ltype != 'pod': - ltype = None - break - ltype = self.LT_POD + elif fqname == 'perl.comment': + return self.LT_COMMENT + elif fqname.startswith('perl.pod'): + return self.LT_POD else: - ltype = None - break - return ltype + return None + return None def _fix_comments(self, c, w): y1 = c.y @@ -613,7 +601,7 @@ class PerlWrapParagraph(WrapParagraph): m = self.comment_re.match(lines[0]) assert m prepend = m.group(1) + m.group(2) - rmargin = self.margin - len(prepend) + rmargin = self.margin - len(prepend) - 1 dpad = m.group(3) segments = [] @@ -648,9 +636,6 @@ class PerlWrapParagraph(WrapParagraph): w.buffer.insert_lines(p1, lines2) w.set_error("wrapped comment lines %d-%d" % (y1 + 1, y2 + 1)) - def _fix_pod(self, c, w): - w.set_error("pod wrapping not yet supported") - def _execute(self, w, **vargs): c = w.logical_cursor() ltype = self._detect_line_type(w, c.y)