Fix sending interrupt commands after SIGINT

Via @benmoss.  Closes #182.
This commit is contained in:
Tim Pope 2014-10-21 15:16:58 -04:00
parent eeccb69a2f
commit 97758acc16
1 changed files with 13 additions and 5 deletions

View File

@ -147,11 +147,14 @@ function! s:nrepl_eval(expr, ...) dict abort
endif
try
let response = self.process(msg)
catch /^Vim:Interrupt$/
if has_key(msg, 'session')
call self.message({'op': 'interrupt', 'session': msg.session, 'interrupt-id': msg.id}, 'ignore')
finally
if !exists('response')
let session = get(msg, 'session', self.session)
if !empty(session)
call self.message({'op': 'interrupt', 'session': session, 'interrupt-id': msg.id}, 'ignore')
endif
throw 'Clojure: Interrupt'
endif
throw 'Clojure: Interrupt'
endtry
if has_key(response, 'ns') && !has_key(options, 'ns')
let self.ns = response.ns
@ -175,7 +178,12 @@ function! s:extract_last_stacktrace(nrepl, session) abort
endif
endif
let format_st = '(symbol (str "\n\b" (apply str (interleave (repeat "\n") (map str (.getStackTrace *e)))) "\n\b\n"))'
let stacktrace = split(get(split(a:nrepl.process({'op': 'eval', 'code': '['.format_st.' *3 *2 *1]', 'ns': 'user', 'session': a:session}).value[0], "\n\b\n"), 1, ""), "\n")
let response = a:nrepl.process({'op': 'eval', 'code': '['.format_st.' *3 *2 *1]', 'ns': 'user', 'session': a:session})
try
let stacktrace = split(get(split(response.value[0], "\n\b\n"), 1, ""), "\n")
catch
throw string(response)
endtry
call a:nrepl.message({'op': 'eval', 'code': '(*1 1)', 'ns': 'user', 'session': a:session})
call a:nrepl.message({'op': 'eval', 'code': '(*2 2)', 'ns': 'user', 'session': a:session})
call a:nrepl.message({'op': 'eval', 'code': '(*3 3)', 'ns': 'user', 'session': a:session})