[meld] meldbuffer: Make undo actions place the cursor at a natural position



commit 16aea53a8673527c7f2c3fb7eeebd7d36a80598d
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Apr 3 07:31:57 2016 +1000

    meldbuffer: Make undo actions place the cursor at a natural position
    
    When a user undoes an action, we should move the cursor to the location
    it would be at if the action was taken by a human. This is consistent
    with what other editors do.

 meld/meldbuffer.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index f70eaff..9e75887 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -308,10 +308,12 @@ class BufferAction(object):
         start = self.buffer.get_iter_at_offset(self.offset)
         end = self.buffer.get_iter_at_offset(self.offset + len(self.text))
         self.buffer.delete(start, end)
+        self.buffer.place_cursor(end)
         return [self]
 
     def insert(self):
         start = self.buffer.get_iter_at_offset(self.offset)
+        self.buffer.place_cursor(start)
         self.buffer.insert(start, self.text)
         return [self]
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]