Skip to content
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

Fix bug when wrapping word at end of line in normal mode #67

Merged
merged 1 commit into from
Sep 5, 2018
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
Fix bug when wrapping word at end of line in normal mode
SidOfc committed Sep 5, 2018
commit 4195f9569c40b3df55a9abefe70ad42a8473a575
4 changes: 3 additions & 1 deletion autoload/mkdx.vim
Original file line number Diff line number Diff line change
@@ -566,6 +566,8 @@ fun! s:util.WrapSelectionOrWord(...)
let mode = get(a:000, 0, 'n')
let start = get(a:000, 1, '')
let end = get(a:000, 2, start)
let vcol = virtcol('.')
let llen = strlen(getline('.'))
let _r = @z

if (mode != 'n')
@@ -580,7 +582,7 @@ fun! s:util.WrapSelectionOrWord(...)
else
normal! "zdiw
let @z = start . @z . end
exe 'normal! "z' . ((virtcol('.') == strlen(getline('.'))) ? 'p' : 'P')
exe 'normal! "z' . ((vcol == llen) ? 'p' : 'P')
endif

let zz = @z
12 changes: 6 additions & 6 deletions test/components/wrapping.vader
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Given (A paragraph of text):
Hello there
Hello there.
this is an awesome short
paragraph of text
that I use to test links

Do ($vb<prefix>ln):
:normal! $vb\<cr> lnhello
Do (2eviw<prefix>ln):
:normal! 2eviw\<cr> lnhello

Expect (The word "Hello" to be a link):
Hello [there](hello)
Hello [there](hello).
this is an awesome short
paragraph of text
that I use to test links
@@ -19,7 +19,7 @@ Do (jV<prefix>ln):
jV lnhello

Expect (The word "Hello" to be a link):
Hello there
Hello there.
[this is an awesome short](hello)
paragraph of text
that I use to test links
@@ -28,7 +28,7 @@ Do (jVj<prefix>ln):
jVj lnhello

Expect (The word "Hello" to be a link):
Hello there
Hello there.
[this is an awesome short
paragraph of text](hello)
that I use to test links