[gedit-plugins] Improved handling of scrolling for replace-all command



commit af08084c62f45198947431f8b9bab967097ab23f
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Thu Apr 29 19:15:09 2010 +0200

    Improved handling of scrolling for replace-all command

 plugins/commander/modules/find/finder.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/plugins/commander/modules/find/finder.py b/plugins/commander/modules/find/finder.py
index 3abc16b..bc453f1 100644
--- a/plugins/commander/modules/find/finder.py
+++ b/plugins/commander/modules/find/finder.py
@@ -195,7 +195,7 @@ class Finder:
 
 		self.cancel()
 		yield commands.result.DONE
-	
+
 	def _restore_cursor(self, mark):
 		buf = mark.get_buffer()
 		
@@ -221,10 +221,16 @@ class Finder:
 		
 		if not ret:
 			yield commands.result.DONE
-		
+
+		self.scroll_back = False
+
 		# Then ask for the replacement string
 		if not self.replacestr:
 			try:
+				if replaceall:
+					self.scroll_back = True
+					self.select_last_result()
+
 				replacestr, words, modifier = (yield commands.result.Prompt('Replace with:'))
 				self.set_replace(replacestr)
 			except GeneratorExit, e:
@@ -272,10 +278,11 @@ class Finder:
 				buf.end_user_action()
 
 			self.cancel()
-			raise e				
+			raise e
 
 		if replaceall:
-			self._restore_cursor(startmark)
+			if self.scroll_back:
+				self._restore_cursor(startmark)
 
 			buf.end_user_action()
 



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