From 0293220768a90ecbf0a0d83f56bf036a8650f52f Mon Sep 17 00:00:00 2001 From: Gamal Date: Tue, 23 Jun 2015 22:22:53 -0500 Subject: [PATCH] Add InProgress state Adding the symbol ~ as in progress state --- SublimeTask.py | 10 +++++++--- Task.JSON-tmLanguage | 12 ++++++++---- Task.tmLanguage | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/SublimeTask.py b/SublimeTask.py index e35e66c..0c997eb 100644 --- a/SublimeTask.py +++ b/SublimeTask.py @@ -4,7 +4,6 @@ import re import sublime_plugin - class TaskCommand(sublime_plugin.TextCommand): def run(self, edit): for region in self.view.sel(): @@ -20,10 +19,15 @@ def process(self, line): # p = re.compile('^(\s*)([-✓])(.*)') # http://docs.python.org/howto/unicode line = line.encode(self.current_encoding()) - p = re.compile(ur'^(\s*)(-|\xe2\x9c\x93)(.*)', re.UNICODE) + p = re.compile(ur'^(\s*)(-|~|\xe2\x9c\x93)(.*)', re.UNICODE) m = p.match(line) if m: - symbol = '✓' if m.group(2) == '-' else '-' + symbol = '-' + if m.group(2) == '-': + symbol = '~' + elif m.group(2) == '~': + symbol = '✓' + result = '%(leading_whitespace)s%(symbol)s%(content)s' % {'leading_whitespace': m.group(1), 'symbol': symbol, 'content': m.group(3)} return result.decode(self.current_encoding()) else: diff --git a/Task.JSON-tmLanguage b/Task.JSON-tmLanguage index 0170935..67d5f78 100644 --- a/Task.JSON-tmLanguage +++ b/Task.JSON-tmLanguage @@ -11,15 +11,19 @@ "match": "[\\[\\]]", "comment": "[ and ]" }, - { "name": "variable", - "match": "^[^-✓]*:\\s+", + { "name": "support.function", + "match": "^[^-~✓]*:\\s+", "comment": "Task Title" }, - { "name": "string", + { "name": "variable.parameter", + "match": "^\\s*~[^\\[\\]]*", + "comment": "Started Tasks" + }, + { "name": "entity.other.attribute-name", "match": "^\\s*✓[^\\[\\]]*", "comment": "Completed Tasks" }, - { "name": "constant", + { "name": "keyword", "match": "^\\s*-[^\\[\\]]*", "comment": "Action Items" }, diff --git a/Task.tmLanguage b/Task.tmLanguage index 00e3cda..30a2b52 100644 --- a/Task.tmLanguage +++ b/Task.tmLanguage @@ -34,9 +34,17 @@ comment Task Title match - ^[^-✓]*:\s+ + ^[^-~✓]*:\s+ name - variable + support.function + + + comment + Started Tasks + match + ^\s*~[^\[\]]* + name + variable.parameter comment @@ -44,7 +52,7 @@ match ^\s*✓[^\[\]]* name - string + entity.other.attribute-name comment @@ -52,7 +60,7 @@ match ^\s*-[^\[\]]* name - constant + keyword comment @@ -68,4 +76,4 @@ uuid 47fcd6b9-58c4-4518-855b-a7e16298177c - + \ No newline at end of file