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
5af256de
Kaydet (Commit)
5af256de
authored
Agu 04, 2000
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Corrected a bug in handling of ^N and ^P with stripspaces on.
üst
57500175
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
textpad.py
Lib/curses/textpad.py
+12
-8
No files found.
Lib/curses/textpad.py
Dosyayı görüntüle @
5af256de
...
@@ -20,13 +20,13 @@ class Textbox:
...
@@ -20,13 +20,13 @@ class Textbox:
Ctrl-A Go to left edge of window.
Ctrl-A Go to left edge of window.
Ctrl-B Cursor left, wrapping to previous line if appropriate.
Ctrl-B Cursor left, wrapping to previous line if appropriate.
Ctrl-D Delete character under cursor.
Ctrl-D Delete character under cursor.
Ctrl-E Go to right edge (
nospaces off) or end of line (no
spaces on).
Ctrl-E Go to right edge (
stripspaces off) or end of line (strip
spaces on).
Ctrl-F Cursor right, wrapping to next line when appropriate.
Ctrl-F Cursor right, wrapping to next line when appropriate.
Ctrl-G Terminate, returning the window contents.
Ctrl-G Terminate, returning the window contents.
Ctrl-H Delete character backward.
Ctrl-H Delete character backward.
Ctrl-J Terminate if the window is 1 line, otherwise insert newline.
Ctrl-J Terminate if the window is 1 line, otherwise insert newline.
Ctrl-K If line is blank, delete it, otherwise clear to end of line.
Ctrl-K If line is blank, delete it, otherwise clear to end of line.
Ctrl-L Refresh screen
Ctrl-L Refresh screen
.
Ctrl-N Cursor down; move down one line.
Ctrl-N Cursor down; move down one line.
Ctrl-O Insert a blank line at cursor location.
Ctrl-O Insert a blank line at cursor location.
Ctrl-P Cursor up; move up one line.
Ctrl-P Cursor up; move up one line.
...
@@ -46,7 +46,7 @@ class Textbox:
...
@@ -46,7 +46,7 @@ class Textbox:
self
.
lastcmd
=
None
self
.
lastcmd
=
None
win
.
keypad
(
1
)
win
.
keypad
(
1
)
def
firstblank
(
self
,
y
):
def
_end_of_line
(
self
,
y
):
"Go to the location of the first blank on the given line."
"Go to the location of the first blank on the given line."
last
=
self
.
maxx
last
=
self
.
maxx
while
1
:
while
1
:
...
@@ -79,7 +79,7 @@ class Textbox:
...
@@ -79,7 +79,7 @@ class Textbox:
elif
y
==
0
:
elif
y
==
0
:
pass
pass
elif
self
.
stripspaces
:
elif
self
.
stripspaces
:
self
.
win
.
move
(
y
-
1
,
self
.
firstblank
(
y
-
1
))
self
.
win
.
move
(
y
-
1
,
self
.
_end_of_line
(
y
-
1
))
else
:
else
:
self
.
win
.
move
(
y
-
1
,
self
.
maxx
)
self
.
win
.
move
(
y
-
1
,
self
.
maxx
)
if
ch
in
(
ascii
.
BS
,
curses
.
KEY_BACKSPACE
):
if
ch
in
(
ascii
.
BS
,
curses
.
KEY_BACKSPACE
):
...
@@ -88,7 +88,7 @@ class Textbox:
...
@@ -88,7 +88,7 @@ class Textbox:
self
.
win
.
delch
()
self
.
win
.
delch
()
elif
ch
==
ascii
.
ENQ
:
# ^e
elif
ch
==
ascii
.
ENQ
:
# ^e
if
self
.
stripspaces
:
if
self
.
stripspaces
:
self
.
win
.
move
(
y
,
self
.
firstblank
(
y
))
self
.
win
.
move
(
y
,
self
.
_end_of_line
(
y
))
else
:
else
:
self
.
win
.
move
(
y
,
self
.
maxx
)
self
.
win
.
move
(
y
,
self
.
maxx
)
elif
ch
in
(
ascii
.
ACK
,
curses
.
KEY_RIGHT
):
# ^f
elif
ch
in
(
ascii
.
ACK
,
curses
.
KEY_RIGHT
):
# ^f
...
@@ -106,7 +106,7 @@ class Textbox:
...
@@ -106,7 +106,7 @@ class Textbox:
elif
y
<
self
.
maxy
:
elif
y
<
self
.
maxy
:
self
.
win
.
move
(
y
+
1
,
0
)
self
.
win
.
move
(
y
+
1
,
0
)
elif
ch
==
ascii
.
VT
:
# ^k
elif
ch
==
ascii
.
VT
:
# ^k
if
x
==
0
and
self
.
firstblank
(
y
)
==
0
:
if
x
==
0
and
self
.
_end_of_line
(
y
)
==
0
:
self
.
win
.
deleteln
()
self
.
win
.
deleteln
()
else
:
else
:
self
.
win
.
clrtoeol
()
self
.
win
.
clrtoeol
()
...
@@ -115,11 +115,15 @@ class Textbox:
...
@@ -115,11 +115,15 @@ class Textbox:
elif
ch
in
(
ascii
.
SO
,
curses
.
KEY_DOWN
):
# ^n
elif
ch
in
(
ascii
.
SO
,
curses
.
KEY_DOWN
):
# ^n
if
y
<
self
.
maxy
:
if
y
<
self
.
maxy
:
self
.
win
.
move
(
y
+
1
,
x
)
self
.
win
.
move
(
y
+
1
,
x
)
if
x
>
self
.
_end_of_line
(
y
+
1
):
self
.
win
.
move
(
y
+
1
,
self
.
_end_of_line
(
y
+
1
))
elif
ch
==
ascii
.
SI
:
# ^o
elif
ch
==
ascii
.
SI
:
# ^o
self
.
win
.
insertln
()
self
.
win
.
insertln
()
elif
ch
in
(
ascii
.
DLE
,
curses
.
KEY_UP
):
# ^p
elif
ch
in
(
ascii
.
DLE
,
curses
.
KEY_UP
):
# ^p
if
y
>
0
:
if
y
>
0
:
self
.
win
.
move
(
y
-
1
,
x
)
self
.
win
.
move
(
y
-
1
,
x
)
if
x
>
self
.
_end_of_line
(
y
-
1
):
self
.
win
.
move
(
y
-
1
,
self
.
_end_of_line
(
y
-
1
))
return
1
return
1
def
gather
(
self
):
def
gather
(
self
):
...
@@ -127,8 +131,8 @@ class Textbox:
...
@@ -127,8 +131,8 @@ class Textbox:
result
=
""
result
=
""
for
y
in
range
(
self
.
maxy
+
1
):
for
y
in
range
(
self
.
maxy
+
1
):
self
.
win
.
move
(
y
,
0
)
self
.
win
.
move
(
y
,
0
)
stop
=
self
.
firstblank
(
y
)
stop
=
self
.
_end_of_line
(
y
)
#sys.stderr.write("y=%d,
firstblank
(y)=%d\n" % (y, stop))
#sys.stderr.write("y=%d,
_end_of_line
(y)=%d\n" % (y, stop))
if
stop
==
0
and
self
.
stripspaces
:
if
stop
==
0
and
self
.
stripspaces
:
continue
continue
for
x
in
range
(
self
.
maxx
+
1
):
for
x
in
range
(
self
.
maxx
+
1
):
...
...
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