mirror of https://github.com/chzyer/readline.git
fix typo
This commit is contained in:
parent
9848c61567
commit
bfdaae1594
4
char.go
4
char.go
|
@ -16,7 +16,7 @@ const (
|
|||
CharPrev = 16
|
||||
CharBckSearch = 18
|
||||
CharFwdSearch = 19
|
||||
CharTransform = 20
|
||||
CharTranspose = 20
|
||||
CharCtrlW = 23
|
||||
CharEsc = 27
|
||||
CharEscapeEx = 91
|
||||
|
@ -28,5 +28,5 @@ const (
|
|||
MetaNext
|
||||
MetaDelete
|
||||
MetaBackspace
|
||||
MetaTransform
|
||||
MetaTranspose
|
||||
)
|
||||
|
|
|
@ -60,8 +60,8 @@ func (l *Operation) ioloop() {
|
|||
l.buf.Kill()
|
||||
case MetaNext:
|
||||
l.buf.MoveToNextWord()
|
||||
case CharTransform:
|
||||
l.buf.Transform()
|
||||
case CharTranspose:
|
||||
l.buf.Transpose()
|
||||
case MetaPrev:
|
||||
l.buf.MoveToPrevWord()
|
||||
case MetaDelete:
|
||||
|
|
|
@ -123,7 +123,7 @@ func (r *RuneBuffer) Kill() {
|
|||
r.Refresh()
|
||||
}
|
||||
|
||||
func (r *RuneBuffer) Transform() {
|
||||
func (r *RuneBuffer) Transpose() {
|
||||
if len(r.buf) < 2 {
|
||||
if len(r.buf) == 1 {
|
||||
r.idx++
|
||||
|
@ -133,6 +133,8 @@ func (r *RuneBuffer) Transform() {
|
|||
}
|
||||
if r.idx == 0 {
|
||||
r.idx = 1
|
||||
} else if r.idx >= len(r.buf) {
|
||||
r.idx = len(r.buf) - 1
|
||||
}
|
||||
r.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
|
||||
r.idx++
|
||||
|
|
Loading…
Reference in New Issue