Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug fix: Strip newlines from warnings

The communication between `luainspect.vim' and `luainspect4vim.lua' for
the `highlight' action assumes that warning messages never span multiple
lines, but LuaInspect sometimes does include newlines in warnings. This
broke the separation between warning messages and highlight positions
which meant `luainspect.vim' would print "Invalid output" messages.
  • Loading branch information...
commit 59ba90c6c496dfe929cb83b896fe4e594d06354a 1 parent f0eeca2
Peter Odding authored August 16, 2010
4  luainspect.vim
... ...
@@ -1,8 +1,8 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 15, 2010
  3
+" Last Change: August 16, 2010
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5  
-" Version: 0.4
  5
+" Version: 0.4.1
6 6
 " License: MIT
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.
7  luainspect4vim.lua
@@ -3,7 +3,7 @@
3 3
  This module is part of the luainspect.vim plug-in for the Vim text editor.
4 4
 
5 5
  Author: Peter Odding <peter@peterodding.com>
6  
- Last Change: August 15, 2010
  6
+ Last Change: August 16, 2010
7 7
  URL: http://peterodding.com/code/vim/lua-inspect/
8 8
  License: MIT
9 9
 
@@ -53,7 +53,10 @@ function actions.highlight(tokenlist, line, column, src) -- {{{1
53 53
   -- FIXME Why does this report argument count warnings in luainspect/init.lua but not in example.lua?!
54 54
   local warnings = LI.list_warnings(tokenlist, src)
55 55
   myprint(#warnings)
56  
-  for i, warning in ipairs(warnings) do myprint(warning) end
  56
+  for i, warning in ipairs(warnings) do
  57
+    warning = warning:gsub('%s+', ' ')
  58
+    myprint(warning)
  59
+  end
57 60
   local curvar = getcurvar(tokenlist, line, column)
58 61
   for i, token in ipairs(tokenlist) do
59 62
     if curvar and curvar.ast.id == token.ast.id then

0 notes on commit 59ba90c

Please sign in to comment.
Something went wrong with that request. Please try again.