Skip to content
Browse files

add edit points detection for css

  • Loading branch information...
1 parent 56471aa commit d39fb5ba92c409b0de2550f55e82dd028bfd0faf @fmarcia committed
Showing with 8 additions and 3 deletions.
  1. +8 −3 zencoding/zen_actions.py
View
11 zencoding/zen_actions.py
@@ -10,7 +10,7 @@
"""
from zencoding import zen_core as zen_coding
from zencoding import html_matcher, zen_file
-from zen_core import char_at, ZenError
+from zen_core import char_at, ZenError
import re
import base64
@@ -248,6 +248,7 @@ def find_new_edit_point(editor, inc=1, offset=0):
"""
cur_point = editor.get_caret_pos() + offset
content = editor.get_content()
+ syntax = editor.get_syntax()
max_len = len(content)
next_point = -1
re_empty_line = r'^\s+$'
@@ -267,13 +268,17 @@ def get_line(ix):
next_char = char_at(content, cur_point + 1)
prev_char = char_at(content, cur_point - 1)
- if cur_char in '"\'':
+ if cur_char in '"\'' and syntax != 'css':
if next_char == cur_char and prev_char == '=':
# empty attribute
next_point = cur_point + 1
- elif cur_char == '>' and next_char == '<':
+ elif cur_char == '>' and next_char == '<' and syntax != 'css':
# between tags
next_point = cur_point + 1
+ elif cur_char == ':' and next_char == ';' and syntax == 'css':
+ next_point = cur_point + 1
+ elif cur_char == '(' and next_char == ')' and syntax == 'css':
+ next_point = cur_point + 1
elif cur_char in '\r\n':
# empty line
if re.search(re_empty_line, get_line(cur_point - 1)):

0 comments on commit d39fb5b

Please sign in to comment.
Something went wrong with that request. Please try again.