@@ -30,6 +30,7 @@ import {
30
30
VariableExpression ,
31
31
} from './types' ;
32
32
import { Pattern , SearchDirection } from '../pattern' ;
33
+ import { SearchState } from '../../state/searchState' ;
33
34
34
35
// ID of next lambda; incremented each time one is created
35
36
let lambdaNumber = 1 ;
@@ -254,14 +255,12 @@ export class EvaluationContext {
254
255
toInt ( this . evaluate ( expression . if ) ) !== 0 ? expression . then : expression . else ,
255
256
) ;
256
257
case 'comparison' :
257
- const _lhs = this . evaluate ( expression . lhs ) ;
258
- const _rhs = this . evaluate ( expression . rhs ) ;
259
258
return bool (
260
259
this . evaluateComparison (
261
260
expression . operator ,
262
261
expression . matchCase ?? configuration . ignorecase ,
263
- _lhs ,
264
- _rhs ,
262
+ this . evaluate ( expression . lhs ) ,
263
+ this . evaluate ( expression . rhs ) ,
265
264
) ,
266
265
) ;
267
266
default : {
@@ -318,7 +317,6 @@ export class EvaluationContext {
318
317
// TODO: v:count, v:count1, v:prevcount
319
318
// TODO: v:operator
320
319
// TODO: v:register
321
- // TODO: v:searchforward
322
320
// TODO: v:statusmsg, v:warningmsg, v:errmsg
323
321
if ( varExpr . name === 'true' ) {
324
322
return bool ( true ) ;
@@ -351,6 +349,8 @@ export class EvaluationContext {
351
349
return int ( 64 ) ;
352
350
} else if ( varExpr . name === 'errors' ) {
353
351
return list ( this . errors . map ( str ) ) ;
352
+ } else if ( varExpr . name === 'searchforward' ) {
353
+ return int ( globalState . searchState ?. direction === SearchDirection . Backward ? 0 : 1 ) ;
354
354
}
355
355
356
356
// HACK: for things like v:key & v:val
0 commit comments