- block = @find_block_parent n
- changed = false
- n = @cursor.n.parent
- while n and n isnt block
- changed = true
- while n.children.length > 0
- @move_node n.children[0], n.parent, n
- @remove_node n
- n = n.parent
- # replace @cursor.n with a single (preserved) space
- if @cursor.n.text != ' '
- changed = true
- @cursor.n.text = @cursor.n.el.textContent = ' '
- if changed
- @text_cleanup @cursor.n
- # place the cursor to the left of that space
- new_cursor = new_cursor_position n: @cursor.n, i: 0
- else # emptying a text node (but not a whole text run)
- # figure out where cursor should land
- block = @find_block_parent @cursor.n
- new_cursor = find_prev_cursor_position @tree, n: @cursor.n, i: 0
- ncb = @find_block_parent new_cursor
- if ncb isnt block
- new_cursor = find_next_cursor_position @tree, n: @cursor.n, i: 1
- # delete text node
- @remove_node @cursor.n
- # delete any inline parents
- n = @cursor.n.parent
- while n and n isnt block
- while n.children.length > 0
- @move_node n.children[0], n.parent, n
- @remove_node n
- n = n.parent
- # update cursor dest in case things moved around
- if new_cursor?
- new_cursor = new_cursor_position n: new_cursor.n, i: new_cursor.i
+ block = @find_block_parent @cursor.n
+ changed = false
+ n = @cursor.n.parent
+ while n and n isnt block
+ changed = true
+ while n.children.length > 0
+ @move_node n.children[0], n.parent, n
+ @remove_node n
+ n = n.parent
+ # replace @cursor.n with a single (preserved) space
+ if @cursor.n.text != ' '
+ changed = true
+ @cursor.n.text = @cursor.n.el.textContent = ' '
+ if changed
+ @text_cleanup @cursor.n
+ # place the cursor to the left of that space
+ new_cursor = new_cursor_position n: @cursor.n, i: 0
+ else # emptying a text node (but not a whole text run)
+ # figure out where cursor should land
+ block = @find_block_parent @cursor.n
+ new_cursor = find_prev_cursor_position @tree, n: @cursor.n, i: 0
+ ncb = @find_block_parent new_cursor
+ if ncb isnt block
+ new_cursor = find_next_cursor_position @tree, n: @cursor.n, i: 1
+ # delete text node
+ @remove_node @cursor.n
+ # delete any inline parents
+ n = @cursor.n.parent
+ while n and n isnt block
+ while n.children.length > 0
+ @move_node n.children[0], n.parent, n
+ @remove_node n
+ n = n.parent
+ # update cursor dest in case things moved around
+ if new_cursor?
+ new_cursor = new_cursor_position n: new_cursor.n, i: new_cursor.i