-
Notifications
You must be signed in to change notification settings - Fork 104
clang-format: work around vim/vim#5930 when positioning cursor #145
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
Changes from all commits
307bd77
0cb9b74
00c9314
eac7b92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,7 +178,33 @@ that clang-format has a version >= 3.4). | |
| :echomsg getline('.')[col('.')-1] | ||
| ~ 5 | ||
|
|
||
| This should work when with textprops set in the file, despite various functions | ||
| like line2byte() and :goto being buggy in that case. | ||
| (See https://github.com/vim/vim/issues/5930 for bug details) | ||
|
|
||
| @clear | ||
| % int f() {<CR> | ||
| | int i=1;<CR> | ||
| | return 1234567890; }<CR> | ||
| :call prop_type_add('keyword', {}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, these make the vroom tests blow up on older versions of vim: https://travis-ci.org/github/google/vim-codefmt/jobs/680186570. Can you change those to only conditionally add the props if vim supports them? And then IIUC the rest of the test should pass regardless on older vims, just won't be covering your workaround logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, sorry about that. Sent #150 |
||
| :call prop_add(1, 1, {'length': 3, 'type': 'keyword'}) | ||
| :call cursor(2, 10) | ||
| :echomsg getline('.')[col('.')-1] | ||
| ~ = | ||
| :FormatCode clang-format | ||
| ! clang-format -style file .* -cursor 23 .*2>.* | ||
| $ { "Cursor": 18 } | ||
| $ int f() { | ||
| $ int i = 1; | ||
| $ return 1234567890; | ||
| $ } | ||
| int f() { | ||
| int i = 1; | ||
| return 1234567890; | ||
| } | ||
| @end | ||
| :echomsg getline('.')[col('.')-1] | ||
| ~ = | ||
|
|
||
| You might have wondered where the "-style file" above comes from. The | ||
| clang-format tool accepts a "style" option to control the formatting style. By | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.