@@ -73,7 +73,7 @@ describe("prompt-input history", () => {
7373 expect ( original [ 1 ] . selection ?. startLine ) . toBe ( 1 )
7474 } )
7575
76- test ( "canNavigateHistoryAtCursor only allows multiline boundaries" , ( ) => {
76+ test ( "canNavigateHistoryAtCursor only allows prompt boundaries" , ( ) => {
7777 const value = "a\nb\nc"
7878
7979 expect ( canNavigateHistoryAtCursor ( "up" , value , 0 ) ) . toBe ( true )
@@ -85,7 +85,16 @@ describe("prompt-input history", () => {
8585 expect ( canNavigateHistoryAtCursor ( "up" , value , 5 ) ) . toBe ( false )
8686 expect ( canNavigateHistoryAtCursor ( "down" , value , 5 ) ) . toBe ( true )
8787
88- expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 1 ) ) . toBe ( true )
89- expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 1 ) ) . toBe ( true )
88+ expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 0 ) ) . toBe ( true )
89+ expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 3 ) ) . toBe ( true )
90+ expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 1 ) ) . toBe ( false )
91+ expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 1 ) ) . toBe ( false )
92+
93+ expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 0 , true ) ) . toBe ( true )
94+ expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 3 , true ) ) . toBe ( true )
95+ expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 0 , true ) ) . toBe ( true )
96+ expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 3 , true ) ) . toBe ( true )
97+ expect ( canNavigateHistoryAtCursor ( "up" , "abc" , 1 , true ) ) . toBe ( false )
98+ expect ( canNavigateHistoryAtCursor ( "down" , "abc" , 1 , true ) ) . toBe ( false )
9099 } )
91100} )
0 commit comments