Permalink
Browse files

fix return on empty bullet bug

  • Loading branch information...
erinata committed May 6, 2012
1 parent c7dbc4c commit 5bae07f62583941d6f1d16696414908984b539a7
Showing with 29 additions and 10 deletions.
  1. +6 −6 Bullet.py
  2. +1 −2 Bullet.sublime-settings
  3. +1 −2 README.md
  4. +1 −0 messages.json
  5. +4 −0 messages/0.3.1.txt
  6. +16 −0 test.rst
View
@@ -70,9 +70,9 @@ def on_modified(self, view):
if (row - Bullet.last_line == 1):
previous_line = view.substr(view.line(Bullet.last_pos))
if row != 0 and previous_line != "":
- match_pattern = re.search("^( *|\t*)(\*|\-|\>|\+|[0-9]+\.)(.*)",previous_line)
+ match_pattern = re.search("^( *|\t*)(\*|\-|\>|\+|[0-9]+(\.))(.*)",previous_line)
if match_pattern != None:
- if match_pattern.group(3) == " " or match_pattern.group(3) == "":
+ if match_pattern.group(4) == " " or match_pattern.group(4) == "":
reg_remove = view.find("(\*|\-|\>|\+|[0-9]+\.)(.*)",point_last_row-1)
edit = view.begin_edit()
view.erase(edit,reg_remove)
@@ -90,7 +90,7 @@ def on_modified(self, view):
match_number = re.search("[0-9]+",match_pattern.group(2))
if match_number != None:
last_number = int(match_number.group(0))
- insertion = str(last_number+1) + ". "
+ insertion = str(last_number+1) + match_pattern.group(3) + " "
else:
insertion = ""
edit = view.begin_edit()
@@ -103,9 +103,9 @@ def on_modified(self, view):
if (row - Bullet.last_line == 1):
previous_line = view.substr(view.line(Bullet.last_pos))
if row != 0 and previous_line != "":
- match_pattern = re.search(u"^( *|\t*)(\*|\-|\+|•|⁃|‣|#.|[0-9]+\.)(.*)",previous_line)
+ match_pattern = re.search(u"^( *|\t*)(\*|\-|\+|•|⁃|‣|#.|[0-9]+(\.))(.*)",previous_line)
if match_pattern != None:
- if match_pattern.group(3) == " " or match_pattern.group(3) == "":
+ if match_pattern.group(4) == " " or match_pattern.group(4) == "":
reg_remove = view.find(u"(\*|\-|\+|•|⁃|‣|#.|[0-9]+\.)(.*)",point_last_row-1)
edit = view.begin_edit()
view.erase(edit,reg_remove)
@@ -129,7 +129,7 @@ def on_modified(self, view):
match_number = re.search("[0-9]+",match_pattern.group(2))
if match_number != None:
last_number = int(match_number.group(0))
- insertion = str(last_number+1) + ". "
+ insertion = str(last_number+1) + match_pattern.group(3) + " "
else:
insertion = ""
edit = view.begin_edit()
View
@@ -1,5 +1,4 @@
{
"markdown_bullet_enabled" : true,
- "restructuredtext_bullet_enabled" : false
-
+ "restructuredtext_bullet_enabled" : true
}
View
@@ -1,4 +1,4 @@
-# SublimeBullet (version 0.3.0)
+# SublimeBullet (version 0.3.1)
This is a Sublime Text plugin for markdown style Bullet points and Number lists. It automatically add * , +and - for unordered lists, > for blockquotes, and numbered items for number lists.
@@ -15,7 +15,6 @@ Install manually
1. Download the repo
2. Copy everything in the repo to a folder named "Bullet" under the package folder of SublimeText 2 (create it if it doesn't exist)
-
## Usage
In markdown files, * , + and - are automatically added for unordered lists (aka bullet points). Similarly > are automatically added for multiline blockquote.
View
@@ -1,4 +1,5 @@
{
+ "0.3.1": "messages/0.3.1.txt",
"0.3.0": "messages/0.3.0.txt",
"0.2.0": "messages/0.2.0.txt"
}
View
@@ -0,0 +1,4 @@
+SublimeMarkdown 0.3.1
+
+Changelog
+ - Fixed: Hit return on an empty bullet will delete the bullet
View
@@ -0,0 +1,16 @@
+1. sdfjsdfsd
+2. sdfsd
+3. sdfsdfd
+4.
+
+1^ sdfsdfsdf
+
+
+
+- sfklsdfsd
+- sdfsdf
+- sdfsdf
+-
+
+
+

0 comments on commit 5bae07f

Please sign in to comment.