Skip to content

Commit

Permalink
range fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Jul 1, 2019
1 parent 86a3da0 commit e83a9f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ async function getCurrentSelection() {
let [from, _ ] = await doc.buffer.mark("<")
let [to, __ ] = await doc.buffer.mark(">")
let result: string[] = []
for(let i = from; i <= to; ++i)
for(let i = from - 1; i < to; ++i)
{
result.push(doc.getline(i))
}
return result
}
else if (mode === "n") {
let line = await workspace.nvim.call('line', '.')
return [doc.getline(line)]
return [doc.getline(line - 1)]
}
else if (mode === "i") {
// TODO what to do in insert mode?
Expand Down Expand Up @@ -106,7 +106,7 @@ export async function activate(context: ExtensionContext) {
}
})

let cmdEvalSeleection = commands.registerCommand("powershell.evaluateSelection", async () => {
let cmdEvalSelection = commands.registerCommand("powershell.evaluateSelection", async () => {
let document = await workspace.document
if (!document || document.filetype !== 'ps1') {
return
Expand Down Expand Up @@ -141,5 +141,5 @@ export async function activate(context: ExtensionContext) {

// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable, cmdExecFile);
context.subscriptions.push(disposable, cmdExecFile, cmdEvalSelection);
}

0 comments on commit e83a9f4

Please sign in to comment.