Skip to content

Commit

Permalink
support hlsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Jul 25, 2016
1 parent 4e291cb commit 5a36734
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cmd_line/commands/setoptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SetOptionsCommand extends node.CommandBase {
Configuration.getInstance().set(this._arguments.name!, false);
break;
case SetOptionOperator.Equal:
Configuration.getInstance().set(this._arguments.name!, this._arguments.value);
Configuration.getInstance().set(this._arguments.name!, this._arguments.value!);
break;
default:
break;
Expand Down
11 changes: 8 additions & 3 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class BaseOptionDetails {
}

public source: OptionValueSource = OptionValueSource.Default;
public shouldUpdateView: boolean;
static globalOptionUpdateHandler: () => void;
}

Expand Down Expand Up @@ -97,6 +96,12 @@ class OptionScroll extends BaseOptionDetails {
defaultValue = 20;
}

@RegisterOption
class OptionHightlightSearch extends BaseOptionDetails {
id = "hlsearch";
defaultValue = false;
}

@RegisterOption
class OptionIgnoreCase extends BaseOptionDetails {
id = "ignorecase";
Expand Down Expand Up @@ -235,10 +240,10 @@ export class Configuration {
return Configuration._instance;
}

set(option: string, value?: number | string | boolean, source?: OptionValueSource): void {
set(option: string, value: number | string | boolean, source?: OptionValueSource): void {
let targetOption = OptionMap.allOptions[option];

if (!value) {
if (!targetOption) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,8 @@ export class ModeHandler implements vscode.Disposable {

// Draw search highlight

if (this.currentMode.name === ModeName.SearchInProgressMode) {
if (this.currentMode.name === ModeName.SearchInProgressMode ||
(Configuration.getInstance().get("hlsearch") && vimState.searchState)) {
const searchState = vimState.searchState!;

rangesToDraw.push.apply(rangesToDraw, searchState.matchRanges);
Expand Down

0 comments on commit 5a36734

Please sign in to comment.