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
fc4c0dc0
Commit
fc4c0dc0
authored
Oct 07, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add get_line_buffer() and insert_text(), suggested by Michael McLay.
parent
b1d2b030
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
Modules/readline.c
Modules/readline.c
+40
-0
No files found.
Modules/readline.c
View file @
fc4c0dc0
...
...
@@ -107,12 +107,52 @@ for i in [0, 1, 2, ...] until it returns a non-string.\n\
It should return the next possible completion starting with 'text'.\
"
;
/* Exported function to read the current line buffer */
static
PyObject
*
get_line_buffer
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
if
(
PyArg_NoArgs
(
args
))
return
NULL
;
return
PyString_FromString
(
rl_line_buffer
);
}
static
char
doc_get_line_buffer
[]
=
"\
get_line_buffer([function]) -> string
\n
\
return the current contents of the line buffer.\
"
;
/* Exported function to insert text into the line buffer */
static
PyObject
*
insert_text
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
char
*
s
;
if
(
!
PyArg_ParseTuple
(
args
,
"s"
,
&
s
))
return
NULL
;
rl_insert_text
(
s
);
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
char
doc_insert_text
[]
=
"\
insert_text(string) -> None
\n
\
Insert text into the command line.\
"
;
/* Table of functions exported by the module */
static
struct
PyMethodDef
readline_methods
[]
=
{
{
"parse_and_bind"
,
parse_and_bind
,
1
,
doc_parse_and_bind
},
{
"get_line_buffer"
,
get_line_buffer
,
1
,
doc_get_line_buffer
},
{
"insert_text"
,
insert_text
,
1
,
doc_insert_text
},
{
"read_init_file"
,
read_init_file
,
1
,
doc_read_init_file
},
{
"set_completer"
,
set_completer
,
1
,
doc_set_completer
},
{
0
,
0
}
...
...
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