Skip to content

Commit

Permalink
Move some constants near to their usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jul 31, 2019
1 parent cb8655f commit 500a9ab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/commands/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,6 @@ def apply_patch(self, patch, pts, reset):
self.view.run_command("gs_diff_refresh")


HUNKS_LINES_RE = re.compile(r'@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? ')
HEADER_TO_FILE_RE = re.compile(r'\+\+\+ b/(.+)$')


class GsDiffOpenFileAtHunkCommand(TextCommand, GitCommand):

"""
Expand Down Expand Up @@ -705,6 +701,9 @@ def real_rowcol_in_hunk(hunk, relative_rowcol):
return line.b, 1


HUNKS_LINES_RE = re.compile(r'@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? ')


def split_hunk(hunk):
# type: (str) -> Optional[List[HunkLine]]
"""Split a hunk into (first char, line content, row) tuples
Expand Down Expand Up @@ -739,6 +738,9 @@ def line_indentation(line):
return len(line) - len(line.lstrip())


HEADER_TO_FILE_RE = re.compile(r'\+\+\+ b/(.+)$')


def extract_filename_from_header(header):
# type: (str) -> Optional[str]
match = HEADER_TO_FILE_RE.search(header)
Expand Down

0 comments on commit 500a9ab

Please sign in to comment.