Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7b9bb05d
Commit
7b9bb05d
authored
Oct 19, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up the search a bit -- don't drag a mark around...
parent
cc0ade8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
Tools/idle/SearchBinding.py
Tools/idle/SearchBinding.py
+17
-13
No files found.
Tools/idle/SearchBinding.py
View file @
7b9bb05d
import
string
import
re
import
tkSimpleDialog
import
tkMessageBox
...
...
@@ -52,24 +53,27 @@ class SearchBinding:
self
.
text
.
bell
()
##print "No program"
return
"break"
self
.
text
.
mark_set
(
"find"
,
"insert"
)
while
1
:
chars
=
self
.
text
.
get
(
"find"
,
"find lineend +1c"
)
##print "Searching", `chars`
if
not
chars
:
self
.
text
.
bell
()
##print "end of buffer"
break
m
=
self
.
prog
.
search
(
chars
)
line
,
col
=
map
(
int
,
string
.
split
(
self
.
text
.
index
(
"insert"
),
"."
))
chars
=
self
.
text
.
get
(
"%d.0"
%
line
,
"%d.0"
%
(
line
+
1
))
while
chars
:
m
=
self
.
prog
.
search
(
chars
,
col
)
if
m
:
i
,
j
=
m
.
span
()
self
.
text
.
mark_set
(
"insert"
,
"find +%dc"
%
j
)
self
.
text
.
mark_set
(
"find"
,
"find +%dc"
%
i
)
self
.
text
.
mark_set
(
"insert"
,
"%d.%d"
%
(
line
,
j
)
)
self
.
text
.
tag_remove
(
"sel"
,
"1.0"
,
"end"
)
self
.
text
.
tag_add
(
"sel"
,
"find"
,
"insert"
)
self
.
text
.
tag_add
(
"sel"
,
"%d.%d"
%
(
line
,
i
),
"%d.%d"
%
(
line
,
j
))
self
.
text
.
see
(
"insert"
)
break
self
.
text
.
mark_set
(
"find"
,
"find lineend +1c"
)
line
=
line
+
1
col
=
0
chars
=
self
.
text
.
get
(
"%d.0"
%
line
,
"%d.0"
%
(
line
+
1
))
else
:
# Not found
self
.
text
.
bell
()
return
"break"
def
goto_line_event
(
self
,
event
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment