Mercurial > vim-lawrencium
comparison plugin/lawrencium.vim @ 84:b82babe7fdf8
Fix: blank line added by HgRepo.ReadCommandOutput().
The extra blank line showed up as a change when running :Hgvdiff
author | Shane Harper <shane@shaneharper.net> |
---|---|
date | Fri, 21 Mar 2014 20:26:18 +1100 |
parents | a383a816d975 |
children | 685dfc4b5862 |
comparison
equal
deleted
inserted
replaced
83:a383a816d975 | 84:b82babe7fdf8 |
---|---|
343 let l:hg_command = call(self['GetCommand'], l:all_args, self) | 343 let l:hg_command = call(self['GetCommand'], l:all_args, self) |
344 call s:trace("Running Mercurial command: " . l:hg_command) | 344 call s:trace("Running Mercurial command: " . l:hg_command) |
345 return system(l:hg_command) | 345 return system(l:hg_command) |
346 endfunction | 346 endfunction |
347 | 347 |
348 " Runs a Mercurial command in the repo and read it output into the current | 348 " Runs a Mercurial command in the repo and reads its output into the current |
349 " buffer. | 349 " buffer. |
350 function! s:HgRepo.ReadCommandOutput(command, ...) abort | 350 function! s:HgRepo.ReadCommandOutput(command, ...) abort |
351 function! s:PutOutputIntoBuffer(command_line) | |
352 let l:was_buffer_empty = (line('$') == 1 && getline(1) == '') | |
353 execute '0read!' . escape(a:command_line, '%#\') | |
354 if l:was_buffer_empty " (Always true?) | |
355 " '0read' inserts before the cursor, leaving a blank line which needs to be deleted: | |
356 normal! Gdd | |
357 endif | |
358 endfunction | |
359 | |
351 let l:all_args = [a:command] + a:000 | 360 let l:all_args = [a:command] + a:000 |
352 let l:hg_command = call(self['GetCommand'], l:all_args, self) | 361 let l:hg_command = call(self['GetCommand'], l:all_args, self) |
353 call s:trace("Running Mercurial command: " . l:hg_command) | 362 call s:trace("Running Mercurial command: " . l:hg_command) |
354 execute '0read !' . escape(l:hg_command, '%#\') | 363 call s:PutOutputIntoBuffer(l:hg_command) |
355 endfunction | 364 endfunction |
356 | 365 |
357 " Build a Lawrencium path for the given file and action. | 366 " Build a Lawrencium path for the given file and action. |
358 " By default, the given path will be made relative to the repository root, | 367 " By default, the given path will be made relative to the repository root, |
359 " unless '0' is passed as the 4th argument. | 368 " unless '0' is passed as the 4th argument. |