Skip to content
Browse files

Switch default to case-insensitive filtering, and toggle it for searc…

…h filters according to the original search
  • Loading branch information...
1 parent 523fcc0 commit be350cb101db5ce084e292256bd32dd5e9dac3f0 Carey Underwood committed Nov 20, 2009
Showing with 9 additions and 2 deletions.
  1. +9 −2 proper_editing.py
View
11 proper_editing.py
@@ -20,6 +20,7 @@
import gedit
import gtk
+import gtksourceview2
import re
import bisect
@@ -107,9 +108,10 @@ def fold(buffer):
class Actions(gedit.Plugin):
def Afold_from_search(self, action, window):
view = window.get_active_view()
+ document = window.get_active_document()
buffer = view.get_buffer()
- search, flags = buffer.get_search_text()
+ search, flags = document.get_search_text()
if not search or search == window.get_data("SearchFold")['search']:
if weird.folded(buffer):
return self.Aunfold(action, window)
@@ -126,12 +128,17 @@ def Afold_from_search(self, action, window):
search, flags = buffer.get_text(left, right), 0
+ if flags & 0b100:
+ flags = 0
+ else:
+ flags = gtksourceview2.SEARCH_CASE_INSENSITIVE
+
window.set_data("SearchFold", {'search': search})
start = buffer.get_start_iter()
start.set_line_offset(0)
while start:
- hit = start.forward_search(search, 0)
+ hit = gtksourceview2.iter_forward_search(start, search, flags)
if hit:
hit[0].set_line_offset(0)
hit[1].forward_line()

0 comments on commit be350cb

Please sign in to comment.
Something went wrong with that request. Please try again.