Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve error message behavior

  • Loading branch information...
commit 508b1888c80b9521f5e9c915bfc106d7948a55bf 1 parent 9367af8
@Shougo authored
View
2  autoload/vimshell/commands/eval.vim
@@ -44,7 +44,7 @@ function! s:command.execute(args, context) "{{{
call vimshell#parser#eval_script(line, context)
catch /.*/
let message = v:exception . ' ' . v:throwpoint
- call vimshell#error_line({}, message)
+ call vimshell#error_line(context.fd, message)
return
endtry
endfunction"}}}
View
6 autoload/vimshell/commands/h.vim
@@ -73,9 +73,9 @@ function! s:command.execute(args, context) "{{{
let context.fd = a:context.fd
try
call vimshell#parser#eval_script(hist, context)
- catch /.*/
- call vimshell#error_line({}, v:exception)
- call vimshell#error_line({}, v:throwpoint)
+ catch
+ call vimshell#error_line(context.fd, v:exception)
+ call vimshell#error_line(context.fd, v:throwpoint)
endtry
endfunction"}}}
View
2  autoload/vimshell/commands/vimsh.vim
@@ -77,7 +77,7 @@ function! s:command.execute(args, context) "{{{
catch
let message = (v:exception !~# '^Vim:')?
\ v:exception : v:exception . ' ' . v:throwpoint
- call vimshell#error_line({},
+ call vimshell#error_line(context.fd,
\ printf('%s(%d): %s', join(a:args), i, message))
return
endtry
View
4 autoload/vimshell/init.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: init.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 05 Jan 2014.
+" Last Modified: 17 Jan 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -320,7 +320,7 @@ function! s:switch_vimshell(bufnr, context, path) "{{{
" Delete current prompt.
let promptnr = vimshell#view#_check_user_prompt(line('$')) > 0 ?
\ vimshell#view#_check_user_prompt(line('$')) . ',' : ''
- execute 'silent ' . promptnr . '$delete _'
+ silent execute promptnr . '$delete _'
endif
normal! zb
View
14 autoload/vimshell/interactive.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: interactive.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 06 Jan 2014.
+" Last Modified: 17 Jan 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -266,8 +266,7 @@ function! s:iexe_send_string(string, is_insert, linenr) "{{{
endif
catch
" Error.
- call vimshell#error_line({},
- \ v:exception . ' ' . v:throwpoint)
+ call vimshell#error_line(context.fd, v:exception . ' ' . v:throwpoint)
call vimshell#interactive#exit()
endtry
@@ -602,8 +601,8 @@ function! s:check_password_input(string) "{{{
call b:interactive.process.waitpid()
" Error.
- call vimshell#error_line({}, v:exception . ' ' . v:throwpoint)
let context = vimshell#get_context()
+ call vimshell#error_line(context.fd, v:exception . ' ' . v:throwpoint)
let b:vimshell.continuation = {}
call vimshell#print_prompt(context)
call vimshell#start_insert(mode() ==# 'i')
@@ -616,7 +615,7 @@ function! s:check_scrollback() "{{{
if output_lines > g:vimshell_scrollback_limit
let pos = getpos('.')
" Delete output.
- execute printf('silent %d,%ddelete _', prompt_nr+1,
+ silent execute printf('%d,%ddelete _', prompt_nr+1,
\ (line('.')-g:vimshell_scrollback_limit+1))
if pos != getpos('.')
call setpos('.', pos)
@@ -752,10 +751,11 @@ function! s:check_output(interactive, bufnr, bufnr_save) "{{{
call vimshell#parser#execute_continuation(is_insert)
catch
" Error.
+ let context = vimshell#get_context()
if v:exception !~# '^Vim:Interrupt'
- call vimshell#error_line({}, v:exception . ' ' . v:throwpoint)
+ call vimshell#error_line(
+ \ context.fd, v:exception . ' ' . v:throwpoint)
endif
- let context = vimshell#get_context()
let b:vimshell.continuation = {}
call vimshell#print_prompt(context)
call vimshell#start_insert(is_insert)
View
19 autoload/vimshell/mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 06 Jan 2014.
+" Last Modified: 17 Jan 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -243,10 +243,11 @@ function! vimshell#mappings#execute_line(is_insert) "{{{
call vimshell#parser#execute_continuation(a:is_insert)
catch
" Error.
+ let context = b:vimshell.continuation.context
if v:exception !~# '^Vim\%((\a\+)\)\?:Interrupt'
- call vimshell#error_line({}, v:exception . ' ' . v:throwpoint)
+ call vimshell#error_line(
+ \ context.fd, v:exception . ' ' . v:throwpoint)
endif
- let context = b:vimshell.continuation.context
let b:vimshell.continuation = {}
call vimshell#print_prompt(context)
call vimshell#start_insert(a:is_insert)
@@ -290,7 +291,7 @@ function! s:execute_command_line(is_insert, oldpos) "{{{
endif
" Move to line end.
- normal! $
+ call cursor(0, col('$'))
try
call vimshell#parser#check_script(line)
@@ -304,7 +305,7 @@ function! s:execute_command_line(is_insert, oldpos) "{{{
if g:vimshell_enable_transient_user_prompt
\ && vimshell#view#_check_user_prompt()
" Delete previous user prompt.
- execute vimshell#view#_check_user_prompt().',-1 delete _'
+ silent execute vimshell#view#_check_user_prompt().',-1 delete _'
endif
" Call preparse filter.
@@ -332,14 +333,16 @@ function! s:execute_command_line(is_insert, oldpos) "{{{
endif
" Error.
- call vimshell#error_line({}, 'command not found: ' . matchstr(v:exception,
+ call vimshell#error_line(
+ \ context.fd, 'command not found: ' . matchstr(v:exception,
\ 'File "\zs.*\ze" is not found.'))
call vimshell#next_prompt(context, a:is_insert)
call vimshell#start_insert(a:is_insert)
return
catch
" Error.
- call vimshell#error_line({}, v:exception . ' ' . v:throwpoint)
+ call vimshell#error_line(
+ \ context.fd, v:exception . ' ' . v:throwpoint)
call vimshell#next_prompt(context, a:is_insert)
call vimshell#start_insert(a:is_insert)
return
@@ -413,7 +416,7 @@ function! s:delete_previous_output() "{{{
normal! 0
let [prev_line, prev_col] = searchpos(pprompt, 'bWn')
if prev_line > 0 && next_line - prev_line > 1
- execute printf('%s,%sdelete', prev_line+1, next_line-1)
+ silent execute printf('%s,%sdelete', prev_line+1, next_line-1)
call append(line('.')-1, "* Output was deleted *")
endif
call s:next_prompt()
View
11 plugin/vimshell.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: vimshell.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 25 Nov 2013.
+" Last Modified: 17 Jan 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -185,7 +185,8 @@ function! s:vimshell_execute(args) "{{{
catch
let message = (v:exception !~# '^Vim:')?
\ v:exception : v:exception . ' ' . v:throwpoint
- call vimshell#error_line({}, printf('%s: %s', a:args, message))
+ call vimshell#error_line(
+ \ context.fd, printf('%s: %s', a:args, message))
return
endtry
endfunction"}}}
@@ -221,7 +222,8 @@ function! s:vimshell_interactive(args) "{{{
catch
let message = (v:exception !~# '^Vim:')?
\ v:exception : v:exception . ' ' . v:throwpoint
- call vimshell#error_line({}, printf('%s: %s', a:args, message))
+ call vimshell#error_line(
+ \ context.fd, printf('%s: %s', a:args, message))
return
endtry
endfunction"}}}
@@ -240,7 +242,8 @@ function! s:vimshell_terminal(args) "{{{
catch
let message = (v:exception !~# '^Vim:')?
\ v:exception : v:exception . ' ' . v:throwpoint
- call vimshell#error_line({}, printf('%s: %s', a:args, message))
+ call vimshell#error_line(
+ \ context.fd, printf('%s: %s', a:args, message))
return
endtry
endfunction"}}}
Please sign in to comment.
Something went wrong with that request. Please try again.