Skip to content

Updated docstring regex to allow folding of raw python strings #760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions autoload/pymode/folding.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ let s:blank_regex = '^\s*$'
" Spyder, a very popular IDE for python has a template which includes
" '@author:' ; thus the regex below.
let s:decorator_regex = '^\s*@\(author:\)\@!'
let s:doc_begin_regex = '^\s*[uU]\=\%("""\|''''''\)'
let s:doc_begin_regex = '^\s*[uUrR]\=\%("""\|''''''\)'
let s:doc_end_regex = '\%("""\|''''''\)\s*$'
" This one is needed for the while loop to count for opening and closing
" docstrings.
let s:doc_general_regex = '\%("""\|''''''\)'
let s:doc_line_regex = '^\s*[uU]\=\("""\|''''''\).\+\1\s*$'
let s:doc_line_regex = '^\s*[uUrR]\=\("""\|''''''\).\+\1\s*$'
let s:symbol = matchstr(&fillchars, 'fold:\zs.') " handles multibyte characters
if s:symbol == ''
let s:symbol = ' '
Expand Down Expand Up @@ -42,7 +42,7 @@ fun! pymode#folding#text() " {{{
let line = substitute(line, '\t', onetab, 'g')

let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
let line = substitute(line, '[uU]\=\%("""\|''''''\)', '', '')
let line = substitute(line, '[uUrR]\=\%("""\|''''''\)', '', '')
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) + 1
return line . ' ' . repeat(s:symbol, fillcharcount) . ' ' . foldedlinecount
endfunction "}}}
Expand Down