Skip to content

Commit

Permalink
Don't move cursor unless it's necessary on filter_text.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsf committed Aug 30, 2013
1 parent 5a78379 commit 8b9e11e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions view.go
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,6 @@ func (v *view) copy_region() {
}
}

// assumes that filtered text has the same length
func (v *view) region_to(filter func([]byte) []byte) {
if !v.buf.is_mark_set() {
v.ctx.set_status("The mark is not set now, so there is no region")
Expand Down Expand Up @@ -1564,8 +1563,10 @@ func (v *view) filter_text(from, to cursor_location, filter func([]byte) []byte)
v.action_delete(c1, d)
data := filter(v.buf.history.last_action().data)
v.action_insert(c1, data)
c1.move_n_bytes_forward(data)
v.move_cursor_to(c1)
if v.cursor != c1 {
c1.move_n_bytes_forward(data)
v.move_cursor_to(c1)
}
}

func (v *view) fill_region(maxv int, prefix []byte) {
Expand Down

0 comments on commit 8b9e11e

Please sign in to comment.