summaryrefslogtreecommitdiff
blob: 03510afb15ecd75c06dbc7cade1748e1b1a05f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From facc66d97ee959309ce7900553cc1f7a6517c394 Mon Sep 17 00:00:00 2001
From: Jesse van den Kieboom <jesse@icecrew.nl>
Date: Thu, 29 Apr 2010 17:15:09 +0000
Subject: Improved handling of scrolling for replace-all command

---
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()
 
--
cgit v0.8.3.1