Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
b3b872e
)
bugfix: cursor prev when at first position
author
Jason Woofenden
<jason@jasonwoof.com>
Wed, 16 Mar 2016 22:35:05 +0000
(18:35 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Wed, 16 Mar 2016 22:35:05 +0000
(18:35 -0400)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
a9d0a3c
..
d3b428a
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-388,13
+388,15
@@
find_prev_cursor_position = (tree, n, i) ->
if prev_xyh.x < orig_xyh.x or prev_xyh.y < orig_xyh.y
return [n, prev_i]
return [n, i - 1]
- found_prev = n?
+ found_prev = null
found = null
traverse_tree tree, (node) ->
if node.type is 'text'
+ unless n?
+ found = node
+ return true
if node is n
- if found_prev?
- found = found_prev
+ found = found_prev # null if n is the first text node
return true
found_prev = node
return false