Skip to content

Introduce a move command for the editor - #9292

Merged
Sandeep Somavarapu (sandy081) merged 4 commits into
masterfrom
sandy081/editorCommands
Jul 18, 2016
Merged

Sandeep Somavarapu (sandy081) merged 4 commits into
masterfrom
sandy081/editorCommands

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Jul 14, 2016 •

Copy link
Copy Markdown
Member

PR for #9143

Introduce a move command for placing cursor at a logical view position in the editor.

Usage:

  • Command Id: cursorMove
  • Arguments: {to: $viewPosition}

Allowed view positions:

  • lineStart: Places the cursor at the start of the current line in the view.
  • lineFirstNonWhitespaceCharacter: Places the cursor at the first non white space character of the current line in the view.
  • lineEnd: Places the cursor at the end of the current line in the view.
  • lineLastNonWhitespaceCharacter: Places the cursor at the last non white space character of the current line in the view.
  • lineCenter: Places the cursor at the center of the line in the view.

return this._invokeForAll(ctx, (cursorIndex: number, oneCursor: OneCursor, oneCtx: IOneCursorOperationContext) => OneCursorOp.moveTo(oneCursor, inSelectionMode, ctx.eventData.position, ctx.eventData.viewPosition, ctx.eventSource, oneCtx));
}

private _move(inSelectionMode:boolean, ctx: IMultipleCursorOperationContext): boolean {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inSelectionMode should be added as a boolean argument accepted by the command. Not sure what name would be best.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go for the same name 'inSelectionMode'.

@alexdima

Alexandru Dima (alexdima) commented Jul 15, 2016 •

Copy link
Copy Markdown
Member

Sandeep Somavarapu (@sandy081) I've reviewed

@sandy081

Copy link
Copy Markdown
Member Author

alexandrudima Thanks for the review. Incorporated the review feedback. Take a look. Thanks,

@alexdima

Copy link
Copy Markdown
Member

Sandeep Somavarapu (@sandy081) LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api feature-request Request for new features or functionality VIM VIM issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants