@@ -151,13 +151,10 @@ func (p *Prompt) feed(b []byte) (shouldExit bool, exec *Exec) {
151
151
p .buf = NewBuffer ()
152
152
p .history .Clear ()
153
153
case Up , ControlP :
154
- if ! completing { // Don't use p.completion.Completing() because it takes double operation when switch to selected=-1.
155
- if p .renderer .reverseSearchEnabled {
156
- offsetCnt := strings .Count (p .history .lastReverseFinded , "\n " ) + 1
157
- p .history .lastReverseFinded = ""
158
- p .turnOffReverseSearch (offsetCnt )
159
- }
160
-
154
+ if p .renderer .reverseSearchEnabled {
155
+ offsetCnt := strings .Count (p .history .lastReverseFinded , "\n " ) + 1
156
+ p .turnOffReverseSearch (offsetCnt )
157
+ } else if ! completing { // Don't use p.completion.Completing() because it takes double operation when switch to selected=-1.
161
158
// if this is a multiline buffer and the cursor is not at the top line,
162
159
// then we just move up the cursor
163
160
if p .buf .NewLineCount () > 0 && p .buf .Document ().CursorPositionRow () > 0 {
@@ -168,17 +165,12 @@ func (p *Prompt) feed(b []byte) (shouldExit bool, exec *Exec) {
168
165
p .prevText = p .buf .Text ()
169
166
p .buf = newBuf
170
167
}
171
-
172
- return
173
168
}
174
169
case Down , ControlN :
175
- if ! completing { // Don't use p.completion.Completing() because it takes double operation when switch to selected=-1.
176
- if p .renderer .reverseSearchEnabled {
177
- offsetCnt := strings .Count (p .history .lastReverseFinded , "\n " ) + 1
178
- p .history .lastReverseFinded = ""
179
- p .turnOffReverseSearch (offsetCnt )
180
- }
181
-
170
+ if p .renderer .reverseSearchEnabled {
171
+ offsetCnt := strings .Count (p .history .lastReverseFinded , "\n " ) + 1
172
+ p .turnOffReverseSearch (offsetCnt )
173
+ } else if ! completing { // Don't use p.completion.Completing() because it takes double operation when switch to selected=-1.
182
174
// if this is a multiline buffer and the cursor is not at the top line,
183
175
// then we just move up the cursor
184
176
// debug.Log(fmt.Sprintln("NewLineCount:", p.buf.NewLineCount()))
@@ -192,7 +184,11 @@ func (p *Prompt) feed(b []byte) (shouldExit bool, exec *Exec) {
192
184
p .prevText = p .buf .Text ()
193
185
p .buf = newBuf
194
186
}
195
- return
187
+ }
188
+ case Left , Right :
189
+ if p .renderer .reverseSearchEnabled {
190
+ offsetCnt := strings .Count (p .history .lastReverseFinded , "\n " ) + 1
191
+ p .turnOffReverseSearch (offsetCnt )
196
192
}
197
193
case ControlD :
198
194
if p .buf .Text () == "" {
0 commit comments