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
|
CharPrev = 16
|
||||||
CharBckSearch = 18
|
CharBckSearch = 18
|
||||||
CharFwdSearch = 19
|
CharFwdSearch = 19
|
||||||
CharTransform = 20
|
CharTranspose = 20
|
||||||
CharCtrlW = 23
|
CharCtrlW = 23
|
||||||
CharEsc = 27
|
CharEsc = 27
|
||||||
CharEscapeEx = 91
|
CharEscapeEx = 91
|
||||||
|
@ -28,5 +28,5 @@ const (
|
||||||
MetaNext
|
MetaNext
|
||||||
MetaDelete
|
MetaDelete
|
||||||
MetaBackspace
|
MetaBackspace
|
||||||
MetaTransform
|
MetaTranspose
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,8 +60,8 @@ func (l *Operation) ioloop() {
|
||||||
l.buf.Kill()
|
l.buf.Kill()
|
||||||
case MetaNext:
|
case MetaNext:
|
||||||
l.buf.MoveToNextWord()
|
l.buf.MoveToNextWord()
|
||||||
case CharTransform:
|
case CharTranspose:
|
||||||
l.buf.Transform()
|
l.buf.Transpose()
|
||||||
case MetaPrev:
|
case MetaPrev:
|
||||||
l.buf.MoveToPrevWord()
|
l.buf.MoveToPrevWord()
|
||||||
case MetaDelete:
|
case MetaDelete:
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (r *RuneBuffer) Kill() {
|
||||||
r.Refresh()
|
r.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RuneBuffer) Transform() {
|
func (r *RuneBuffer) Transpose() {
|
||||||
if len(r.buf) < 2 {
|
if len(r.buf) < 2 {
|
||||||
if len(r.buf) == 1 {
|
if len(r.buf) == 1 {
|
||||||
r.idx++
|
r.idx++
|
||||||
|
@ -133,6 +133,8 @@ func (r *RuneBuffer) Transform() {
|
||||||
}
|
}
|
||||||
if r.idx == 0 {
|
if r.idx == 0 {
|
||||||
r.idx = 1
|
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.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
|
||||||
r.idx++
|
r.idx++
|
||||||
|
|
4
utils.go
4
utils.go
|
@ -52,8 +52,8 @@ func escapeKey(r rune) rune {
|
||||||
r = MetaNext
|
r = MetaNext
|
||||||
case 'd':
|
case 'd':
|
||||||
r = MetaDelete
|
r = MetaDelete
|
||||||
case CharTransform:
|
case CharTranspose:
|
||||||
r = MetaTransform
|
r = MetaTranspose
|
||||||
case CharBackspace:
|
case CharBackspace:
|
||||||
r = MetaBackspace
|
r = MetaBackspace
|
||||||
case CharEsc:
|
case CharEsc:
|
||||||
|
|
Loading…
Reference in New Issue