Skip to content

Commit e54264f

Browse files
committed
Add v:searchforward
1 parent 3b82b2d commit e54264f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/vimscript/expression/evaluate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
VariableExpression,
3131
} from './types';
3232
import { Pattern, SearchDirection } from '../pattern';
33+
import { SearchState } from '../../state/searchState';
3334

3435
// ID of next lambda; incremented each time one is created
3536
let lambdaNumber = 1;
@@ -254,14 +255,12 @@ export class EvaluationContext {
254255
toInt(this.evaluate(expression.if)) !== 0 ? expression.then : expression.else,
255256
);
256257
case 'comparison':
257-
const _lhs = this.evaluate(expression.lhs);
258-
const _rhs = this.evaluate(expression.rhs);
259258
return bool(
260259
this.evaluateComparison(
261260
expression.operator,
262261
expression.matchCase ?? configuration.ignorecase,
263-
_lhs,
264-
_rhs,
262+
this.evaluate(expression.lhs),
263+
this.evaluate(expression.rhs),
265264
),
266265
);
267266
default: {
@@ -318,7 +317,6 @@ export class EvaluationContext {
318317
// TODO: v:count, v:count1, v:prevcount
319318
// TODO: v:operator
320319
// TODO: v:register
321-
// TODO: v:searchforward
322320
// TODO: v:statusmsg, v:warningmsg, v:errmsg
323321
if (varExpr.name === 'true') {
324322
return bool(true);
@@ -351,6 +349,8 @@ export class EvaluationContext {
351349
return int(64);
352350
} else if (varExpr.name === 'errors') {
353351
return list(this.errors.map(str));
352+
} else if (varExpr.name === 'searchforward') {
353+
return int(globalState.searchState?.direction === SearchDirection.Backward ? 0 : 1);
354354
}
355355

356356
// HACK: for things like v:key & v:val

0 commit comments

Comments
 (0)