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
4650df96
Commit
4650df96
authored
Oct 13, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the return key do what I mean more often.
parent
b39b90dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Tools/idle/PyShell.py
Tools/idle/PyShell.py
+11
-9
No files found.
Tools/idle/PyShell.py
View file @
4650df96
...
...
@@ -368,9 +368,11 @@ class PyShell(PyShellEditorWindow):
if
self
.
executing
and
not
self
.
reading
:
return
# Let the default binding (insert '\n') take over
# If some text is selected, recall the selection
# (but only if this before the I/O mark)
try
:
sel
=
self
.
text
.
get
(
"sel.first"
,
"sel.last"
)
if
sel
:
if
self
.
text
.
compare
(
"self.last"
,
"<="
,
"iomark"
):
self
.
recall
(
sel
)
return
"break"
except
:
...
...
@@ -379,7 +381,7 @@ class PyShell(PyShellEditorWindow):
# the current line, less a leading prompt, less leading or
# trailing whitespace
if
self
.
text
.
compare
(
"insert"
,
"<"
,
"iomark linestart"
):
# Check if there's a relevant stdin
mark
-- if so, use it
# Check if there's a relevant stdin
range
-- if so, use it
prev
=
self
.
text
.
tag_prevrange
(
"stdin"
,
"insert"
)
if
prev
and
self
.
text
.
compare
(
"insert"
,
"<"
,
prev
[
1
]):
self
.
recall
(
self
.
text
.
get
(
prev
[
0
],
prev
[
1
]))
...
...
@@ -391,13 +393,13 @@ class PyShell(PyShellEditorWindow):
# No stdin mark -- just get the current line
self
.
recall
(
self
.
text
.
get
(
"insert linestart"
,
"insert lineend"
))
return
"break"
# If we're anywhere in the current input (including in the
# prompt) but not at the very end, move the cursor to the end.
if
self
.
text
.
compare
(
"insert"
,
"<"
,
"end-1c"
):
self
.
text
.
mark_set
(
"insert"
,
"end-1c"
)
self
.
text
.
see
(
"insert"
)
# If we're in the current input before its last line,
# insert a newline right at the insert point
if
self
.
text
.
compare
(
"insert"
,
"<"
,
"end-1c linestart"
):
self
.
auto
.
autoindent
(
event
)
return
"break"
# OK, we're already at the end -- insert a newline and run it.
# We're in the last line; append a newline and submit it
self
.
text
.
mark_set
(
"insert"
,
"end-1c"
)
if
self
.
reading
:
self
.
text
.
insert
(
"insert"
,
"
\
n
"
)
self
.
text
.
see
(
"insert"
)
...
...
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