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
f354894e
Kaydet (Commit)
f354894e
authored
Kas 12, 2007
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Only set rl_completion_display_matches_hook if there
is a Python hook function. Fixes #1425.
üst
abfe4536
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
31 deletions
+38
-31
readline.c
Modules/readline.c
+38
-31
No files found.
Modules/readline.c
Dosyayı görüntüle @
f354894e
...
@@ -38,6 +38,10 @@
...
@@ -38,6 +38,10 @@
extern
char
**
completion_matches
(
char
*
,
rl_compentry_func_t
*
);
extern
char
**
completion_matches
(
char
*
,
rl_compentry_func_t
*
);
#endif
#endif
static
void
on_completion_display_matches_hook
(
char
**
matches
,
int
num_matches
,
int
max_length
);
/* Exported function to send one line to readline's init file parser */
/* Exported function to send one line to readline's init file parser */
...
@@ -208,8 +212,17 @@ static PyObject *pre_input_hook = NULL;
...
@@ -208,8 +212,17 @@ static PyObject *pre_input_hook = NULL;
static
PyObject
*
static
PyObject
*
set_completion_display_matches_hook
(
PyObject
*
self
,
PyObject
*
args
)
set_completion_display_matches_hook
(
PyObject
*
self
,
PyObject
*
args
)
{
{
return
set_hook
(
"completion_display_matches_hook"
,
PyObject
*
result
=
set_hook
(
"completion_display_matches_hook"
,
&
completion_display_matches_hook
,
args
);
&
completion_display_matches_hook
,
args
);
#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
/* We cannot set this hook globally, since it replaces the
default completion display. */
rl_completion_display_matches_hook
=
completion_display_matches_hook
?
(
rl_compdisp_func_t
*
)
on_completion_display_matches_hook
:
0
;
#endif
return
result
;
}
}
PyDoc_STRVAR
(
doc_set_completion_display_matches_hook
,
PyDoc_STRVAR
(
doc_set_completion_display_matches_hook
,
...
@@ -668,39 +681,37 @@ static void
...
@@ -668,39 +681,37 @@ static void
on_completion_display_matches_hook
(
char
**
matches
,
on_completion_display_matches_hook
(
char
**
matches
,
int
num_matches
,
int
max_length
)
int
num_matches
,
int
max_length
)
{
{
if
(
completion_display_matches_hook
!=
NULL
)
{
int
i
;
int
i
;
PyObject
*
m
,
*
s
;
PyObject
*
m
,
*
s
;
PyObject
*
r
;
PyObject
*
r
;
#ifdef WITH_THREAD
#ifdef WITH_THREAD
PyGILState_STATE
gilstate
=
PyGILState_Ensure
();
PyGILState_STATE
gilstate
=
PyGILState_Ensure
();
#endif
#endif
m
=
PyList_New
(
num_matches
);
m
=
PyList_New
(
num_matches
);
for
(
i
=
0
;
i
<
num_matches
;
i
++
)
{
for
(
i
=
0
;
i
<
num_matches
;
i
++
)
{
s
=
PyString_FromString
(
matches
[
i
+
1
]);
s
=
PyString_FromString
(
matches
[
i
+
1
]);
PyList_SetItem
(
m
,
i
,
s
);
PyList_SetItem
(
m
,
i
,
s
);
}
}
r
=
PyObject_CallFunction
(
completion_display_matches_hook
,
"sOi"
,
matches
[
0
],
m
,
max_length
);
Py_DECREF
(
m
);
r
=
PyObject_CallFunction
(
completion_display_matches_hook
,
"sOi"
,
matches
[
0
],
m
,
max_length
);
if
(
r
==
NULL
||
Py_DECREF
(
m
);
(
r
!=
Py_None
&&
PyInt_AsLong
(
r
)
==
-
1
&&
PyErr_Occurred
()))
{
goto
error
;
if
(
r
==
NULL
||
}
(
r
!=
Py_None
&&
PyInt_AsLong
(
r
)
==
-
1
&&
PyErr_Occurred
()))
{
goto
error
;
}
Py_DECREF
(
r
);
Py_DECREF
(
r
);
goto
done
;
goto
done
;
error:
error:
PyErr_Clear
();
PyErr_Clear
();
Py_XDECREF
(
r
);
Py_XDECREF
(
r
);
done:
done:
#ifdef WITH_THREAD
#ifdef WITH_THREAD
PyGILState_Release
(
gilstate
);
PyGILState_Release
(
gilstate
);
#endif
#endif
}
}
}
...
@@ -781,10 +792,6 @@ setup_readline(void)
...
@@ -781,10 +792,6 @@ setup_readline(void)
rl_bind_key_in_map
(
'\t'
,
rl_complete
,
emacs_meta_keymap
);
rl_bind_key_in_map
(
'\t'
,
rl_complete
,
emacs_meta_keymap
);
rl_bind_key_in_map
(
'\033'
,
rl_complete
,
emacs_meta_keymap
);
rl_bind_key_in_map
(
'\033'
,
rl_complete
,
emacs_meta_keymap
);
/* Set our hook functions */
/* Set our hook functions */
#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
rl_completion_display_matches_hook
=
(
rl_compdisp_func_t
*
)
on_completion_display_matches_hook
;
#endif
rl_startup_hook
=
(
Function
*
)
on_startup_hook
;
rl_startup_hook
=
(
Function
*
)
on_startup_hook
;
#ifdef HAVE_RL_PRE_INPUT_HOOK
#ifdef HAVE_RL_PRE_INPUT_HOOK
rl_pre_input_hook
=
(
Function
*
)
on_pre_input_hook
;
rl_pre_input_hook
=
(
Function
*
)
on_pre_input_hook
;
...
...
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