Skip to content

Commit bd95501

Browse files
committed
Escape quotes for python, cpp; Remove unused c/c++ option
1 parent e5e1996 commit bd95501

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

doc/debugstring.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ To add a logging statement either use the default normal mode mapping
4242

4343
* nmap <a-second-key-combination> <Plug>DumpDebugStringExpr
4444

45-
*g:debugstringAlwaysIncludeHeader*
46-
Set this to false if you want to print just the logging statement without any
47-
additional directive like '#include <stsdio.h' Applicable only in libraries
48-
that the logging directive is part of an external library
49-
5045

5146
==============================================================================
5247
COMMANDS *debugstring-commands*

ftplugin/c.vim

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ endif
44

55
function! s:DebugStringFunBase(desc, var)
66
let l:debug_str = "printf(\"" . a:desc . "%d\\n\", " . a:var . ");"
7-
8-
if g:debugstringAlwaysIncludeHeader
9-
let l:incStr = '#include <stdio.h>; '
10-
let l:debug_str = l:incStr . l:debug_str
11-
endif
12-
137
return l:debug_str
148
endfunc
159

ftplugin/cpp.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
let g:debugstring_loaded_cpp_vim = 1
22

33
function! s:DebugStringFunBase(desc, var)
4-
let l:debug_str = 'std::cout << "' . a:desc
4+
" Escape quotes in description
5+
let l:desc = a:desc
6+
if stridx('"', l:desc)
7+
let l:desc = substitute(l:desc, '"', '\\"', "g")
8+
endif
9+
10+
let l:debug_str = 'std::cout << "' . l:desc
511
\ . '" << '
612
\ . a:var
713
\ . ' << '
814
\ . 'std::endl;'
915

10-
if g:debugstringAlwaysIncludeHeader
11-
let l:incStr = '#include <iostream>; '
12-
let l:debug_str = l:incStr . l:debug_str
13-
endif
14-
1516
return l:debug_str
1617
endfunc
1718

ftplugin/python.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
function! s:DebugStringFunBase(desc, var)
2-
let l:debug_str = 'print("' . a:desc . '", ' . a:var . ')'
2+
" Escape quotes in description
3+
let l:desc = a:desc
4+
if stridx('"', l:desc)
5+
let l:desc = substitute(l:desc, '"', '\\"', "g")
6+
endif
7+
8+
let l:debug_str = 'print("' . l:desc . '", ' . a:var . ')'
39
return l:debug_str
410
endfunc
511

plugin/debugstring.vim

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,6 @@ if !hasmapto('<Plug>DumpDebugStringCexpr')
138138
nmap <unique> <Leader>DS <Plug>DumpDebugStringCexpr
139139
endif
140140

141-
""
142-
" Set this to false if you want to print just the logging statement without any
143-
" additional directive like '#include <stsdio.h'
144-
" Applicable only in libraries that the logging directive is part of an external
145-
" library
146-
"
147-
let g:debugstringAlwaysIncludeHeader = 0 " Include Header in place?
148-
149141
""
150142
" Wrapper around the low-level debug* methods.
151143
" It also takes care of incrementing the g:debugCounter

test/basic.vader

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ Execute (Lua):
7474
:set filetype=lua
7575

7676
================================================================================
77+
78+
# vim: ft=vader

0 commit comments

Comments
 (0)