Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e9880c81
Kaydet (Commit)
e9880c81
authored
Tem 12, 2001
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
py-cvs merge, python 1.5.2 compatability
üst
42f6c648
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
ReplaceDialog.py
Lib/idlelib/ReplaceDialog.py
+18
-2
No files found.
Lib/idlelib/ReplaceDialog.py
Dosyayı görüntüle @
e9880c81
...
...
@@ -90,7 +90,7 @@ class ReplaceDialog(SearchDialogBase):
line
,
m
=
res
chars
=
text
.
get
(
"
%
d.0"
%
line
,
"
%
d.0"
%
(
line
+
1
))
orig
=
m
.
group
()
new
=
re
.
pcre
_expand
(
m
,
repl
)
new
=
self
.
_expand
(
m
,
repl
)
i
,
j
=
m
.
span
()
first
=
"
%
d.
%
d"
%
(
line
,
i
)
last
=
"
%
d.
%
d"
%
(
line
,
j
)
...
...
@@ -142,7 +142,7 @@ class ReplaceDialog(SearchDialogBase):
m
=
prog
.
match
(
chars
,
col
)
if
not
prog
:
return
0
new
=
re
.
pcre
_expand
(
m
,
self
.
replvar
.
get
())
new
=
self
.
_expand
(
m
,
self
.
replvar
.
get
())
text
.
mark_set
(
"insert"
,
first
)
text
.
undo_block_start
()
if
m
.
group
():
...
...
@@ -154,6 +154,22 @@ class ReplaceDialog(SearchDialogBase):
self
.
ok
=
0
return
1
def
_expand
(
self
,
m
,
template
):
# XXX This code depends on internals of the regular expression
# engine! There's no standard API to do a substitution when you
# have already found the match. One should be added.
# The solution here is designed to be backwards compatible
# with previous Python versions, e.g. 1.5.2.
# XXX This dynamic test should be done only once.
if
getattr
(
re
,
"engine"
,
"pre"
)
==
"pre"
:
return
re
.
pcre_expand
(
m
,
template
)
else
:
# sre
# XXX This import should be avoidable...
import
sre_parse
# XXX This parses the template over and over...
ptemplate
=
sre_parse
.
parse_template
(
template
,
m
.
re
)
return
sre_parse
.
expand_template
(
ptemplate
,
m
)
def
show_hit
(
self
,
first
,
last
):
text
=
self
.
text
text
.
mark_set
(
"insert"
,
first
)
...
...
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