diff --git a/dependencies.json b/dependencies.json index a9d4d5a..0228c11 100644 --- a/dependencies.json +++ b/dependencies.json @@ -1,6 +1,7 @@ { "windows": { ">3000": [ + "psutil", "pyte", "pywinpty", "wcwidth" @@ -9,6 +10,7 @@ "*": { ">3000": [ + "psutil", "ptyprocess", "pyte", "wcwidth" diff --git a/terminus/mouse.py b/terminus/mouse.py index 30d6cb4..9a823a6 100644 --- a/terminus/mouse.py +++ b/terminus/mouse.py @@ -1,16 +1,17 @@ import sublime import sublime_plugin +import os import re import logging import webbrowser from .terminal import Terminal, CONTINUATION -from .utils import highlight_key +from .utils import highlight_key, istext logger = logging.getLogger('Terminus') -rex = re.compile( +URL_REGEX = re.compile( r'''(?x) \b(?: https?://(?:(?:[a-zA-Z0-9\-_]+(?:\.[a-zA-Z0-9\-._]+)+)|localhost)| # http:// @@ -20,7 +21,31 @@ [a-zA-Z0-9\-_~:/#@$*+=] # allowed end chars ''') -URL_POPUP = """ + +FILE_REGEX = re.compile(r''' + (?x) + (?:\b|\/)(?:[a-zA-Z]:[\\/])? # windows drive or unix root + (?:\\.|[^ ?%*:|"<>\n])+ # escaped space or not reserved symbols + (?:\.(?:[^ ?%*:|"<>.\n])+) # must have extensions + (?::[0-9]+){0,2} + | + (?<=") # begin double quotation + (?:\b|\/)(?:[a-zA-Z]:[\\/])? # windows drive or unix root + (?:[^?%*:|"<>\n])+ # not reserved symbols + (?:\.(?:[^ ?%*:|"<>.\n])+) # must have extensions + (?::[0-9]+){0,2} + (?=") # end double quotation + | + (?<=') # begin single quotation + (?:\b|\/)(?:[a-zA-Z]:[\\/])? # windows drive or unix root + (?:[^?%*:|"<>\n])+ # not reserved symbols + (?:\.(?:[^ ?%*:|"<>.\n])+) # must have extensions + (?::[0-9]+){0,2} + (?=') # end single quotation +''') + + +POPUP = """