summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/netbeans.txt7
-rw-r--r--src/mouse.c6
-rw-r--r--src/testdir/test_netbeans.py19
-rw-r--r--src/testdir/test_netbeans.vim179
-rw-r--r--src/testdir/test_quickfix.vim4
-rw-r--r--src/version.c2
6 files changed, 199 insertions, 18 deletions
diff --git a/runtime/doc/netbeans.txt b/runtime/doc/netbeans.txt
index 972b93c48..f780e3b32 100644
--- a/runtime/doc/netbeans.txt
+++ b/runtime/doc/netbeans.txt
@@ -562,9 +562,10 @@ setModtime time
saved directly by the Vim Controller.
New in version 2.3.
-setReadOnly
- Set a file as readonly
- Implemented in version 2.3.
+setReadOnly readonly
+ When the boolean argument "readonly" is "T" for True, mark the
+ buffer as readonly, when it is "F" for False, mark it as not
+ readonly. Implemented in version 2.3.
setStyle Not implemented.
diff --git a/src/mouse.c b/src/mouse.c
index 7b1bedc7e..10b991b98 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -2929,10 +2929,12 @@ mouse_comp_pos(
// skip line number and fold column in front of the line
col -= win_col_off(win);
- if (col < 0)
+ if (col <= 0)
{
#ifdef FEAT_NETBEANS_INTG
- netbeans_gutter_click(lnum);
+ // if mouse is clicked on the gutter, then inform the netbeans server
+ if (*colp < win_col_off(win))
+ netbeans_gutter_click(lnum);
#endif
col = 0;
}
diff --git a/src/testdir/test_netbeans.py b/src/testdir/test_netbeans.py
index 6dc9b4e6f..112602a43 100644
--- a/src/testdir/test_netbeans.py
+++ b/src/testdir/test_netbeans.py
@@ -41,6 +41,8 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
elif re.match('1:insert=.* "\\\\n"', line):
# extract the command from the previous line
cmd = re.search('.*"(.*)"', self.prev_line).group(1)
+
+ # map of test names and the netbeans commands/functions
testmap = {
'getCursor_Test' : '0:getCursor/30\n',
'E627_Test' : '0 setReadOnly!31\n',
@@ -70,6 +72,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
'getModified_Test' : '2:getModified/55\n',
'getText_Test' : '2:getText/56\n',
'setDot_Test' : '2:setDot!57 3/6\n',
+ 'setDot2_Test' : '2:setDot!57 9\n',
'startDocumentListen_Test' : '2:startDocumentListen!58\n',
'stopDocumentListen_Test' : '2:stopDocumentListen!59\n',
'define_anno_Test' : '2:defineAnnoType!60 1 "s1" "x" "=>" blue none\n',
@@ -90,6 +93,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
'remove_invalid_count_Test' : '3:remove/75 1 800\n',
'guard_Test' : '3:guard!76 8 7\n',
'setModified_Test' : '3:setModified!77 T\n',
+ 'setModifiedClear_Test' : '3:setModified!77 F\n',
'insertDone_Test' : '3:insertDone!78 T F\n',
'saveDone_Test' : '3:saveDone!79\n',
'invalidcmd_Test' : '3:invalidcmd!80\n',
@@ -99,11 +103,16 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
'save_fail_Test' : '0:save/84\n',
'netbeansBuffer_fail_Test' : '0:netbeansBuffer/85 T\n',
'setExitDelay_Test' : '0:setExitDelay!86 2\n',
- 'setReadOnly_Test' : '3:setReadOnly!87\n',
- 'close_Test' : '3:close!88\n',
- 'specialKeys_Test' : '0:specialKeys!89 "F12 F13"\n',
- 'nbbufwrite_Test' : '4:editFile!90 "XnbBuffer"\n4:netbeansBuffer!91 T\n',
- 'detach_Test' : '2:close!92\n1:close!93\nDETACH\n'
+ 'setReadOnly_Test' : '3:setReadOnly!87 T\n',
+ 'setReadOnlyClear_Test' : '3:setReadOnly!88 F\n',
+ 'save_Test' : '3:save!89\n',
+ 'close_Test' : '3:close!90\n',
+ 'specialKeys_Test' : '0:specialKeys!91 "F12 F13 C-F13"\n',
+ 'nbbufwrite_Test' : '4:editFile!92 "XnbBuffer"\n4:netbeansBuffer!93 T\n',
+ 'startAtomic_Test' : '0:startAtomic!94\n',
+ 'endAtomic_Test' : '0:endAtomic!95\n',
+ 'AnnoScale_Test' : "".join(['2:defineAnnoType!60 ' + str(i) + ' "s' + str(i) + '" "x" "=>" blue none\n' for i in range(2, 26)]),
+ 'detach_Test' : '2:close!96\n1:close!97\nDETACH\n'
}
# execute the specified test
if cmd not in testmap:
diff --git a/src/testdir/test_netbeans.vim b/src/testdir/test_netbeans.vim
index 75e974d6f..c4851ae1a 100644
--- a/src/testdir/test_netbeans.vim
+++ b/src/testdir/test_netbeans.vim
@@ -303,11 +303,22 @@ func Nb_basic(port)
\ '56 "foo bar1\nfoo bar2\nfoo bar3\n"'], l[-2:])
let g:last += 4
- " setDot test
+ " setDot test with lnum/col
+ call cursor(1, 1)
call appendbufline(cmdbufnr, '$', 'setDot_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
let l = ReadXnetbeans()
call assert_equal('send: 2:setDot!57 3/6', l[-1])
+ call assert_equal([0, 3, 7, 0], getpos('.'))
+ let g:last += 3
+
+ " setDot test with an offset
+ call cursor(1, 1)
+ call appendbufline(cmdbufnr, '$', 'setDot2_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 2:setDot!57 9', l[-1])
+ call assert_equal([0, 2, 1, 0], getpos('.'))
let g:last += 3
" startDocumentListen test
@@ -328,6 +339,32 @@ func Nb_basic(port)
call assert_match('2:remove=\d\+ 0 9', l[-1])
let g:last += 3
+ " Change case using the ~ command with 'whichwrap' containing '~'
+ set whichwrap+=~
+ normal 2G$~
+ set whichwrap&
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 2)')
+ let l = ReadXnetbeans()
+ call assert_match('2:remove=\d\+ 16 1', l[-4])
+ call assert_match('2:insert=\d\+ 16 "Y"', l[-3])
+ call assert_match('2:remove=\d\+ 18 0', l[-2])
+ call assert_match('2:insert=\d\+ 18 ""', l[-1])
+ let g:last += 4
+
+ " Test for replacing spaces with a tab character using 'softtabstop' and
+ " 'noexpandtab'
+ setlocal softtabstop=4
+ setlocal noexpandtab
+ exe "normal I\<Tab>\<Tab>"
+ setlocal expandtab&
+ setlocal softtabstop&
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 18)')
+ let l = ReadXnetbeans()
+ call assert_match('2:insert=\d\+ 18 " foo bar3"', l[-3])
+ call assert_match('2:remove=\d\+ 26 8', l[-2])
+ call assert_match('2:insert=\d\+ 26 "\t"', l[-1])
+ let g:last += 18
+
" stopDocumentListen test
call appendbufline(cmdbufnr, '$', 'stopDocumentListen_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
@@ -491,8 +528,9 @@ func Nb_basic(port)
call assert_equal([{'name': '1', 'texthl': 'NB_s1', 'text': '=>'},
\ {'name': '10000', 'linehl': 'NBGuarded'}],
\ sign_getdefined())
- call assert_equal([{'lnum': 2, 'id': 1000000, 'name': '10000',
- \ 'priority': 10, 'group': ''}], sign_getplaced()[0].signs)
+ let s = sign_getplaced()[0].signs[0]
+ call assert_equal(2, s.lnum)
+ call assert_equal('10000', s.name)
let g:last += 3
" setModified test
@@ -500,9 +538,19 @@ func Nb_basic(port)
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
let l = ReadXnetbeans()
call assert_equal('send: 3:setModified!77 T', l[-1])
+ sleep 1m
call assert_equal(1, &modified)
let g:last += 3
+ " clear setModified test
+ call appendbufline(cmdbufnr, '$', 'setModifiedClear_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 3:setModified!77 F', l[-1])
+ sleep 1m
+ call assert_equal(0, &modified)
+ let g:last += 3
+
" insertDone test
let v:statusmsg = ''
call appendbufline(cmdbufnr, '$', 'insertDone_Test')
@@ -586,15 +634,36 @@ func Nb_basic(port)
call appendbufline(cmdbufnr, '$', 'setReadOnly_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
let l = ReadXnetbeans()
- call assert_equal('send: 3:setReadOnly!87', l[-1])
+ call assert_equal('send: 3:setReadOnly!87 T', l[-1])
+ sleep 1m
+ call assert_equal(1, &readonly)
+ let g:last += 3
+
+ " clear setReadonly test
+ call appendbufline(cmdbufnr, '$', 'setReadOnlyClear_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 3:setReadOnly!88 F', l[-1])
+ sleep 1m
+ call assert_equal(0, &readonly)
+ let g:last += 3
+
+ " save test
+ call setbufvar(bufnr('Xfile4'), '&modified', 1)
+ call appendbufline(cmdbufnr, '$', 'save_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 3:save!89', l[-1])
+ sleep 1m
+ call assert_true(filereadable('Xfile4'))
let g:last += 3
" close test. Don't use buffer 10 after this
call appendbufline(cmdbufnr, '$', 'close_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 4)')
let l = ReadXnetbeans()
- call assert_equal('send: 3:close!88', l[-2])
- call assert_equal('3:killed=88', l[-1])
+ call assert_equal('send: 3:close!90', l[-2])
+ call assert_equal('3:killed=90', l[-1])
call assert_equal(1, winnr('$'))
let g:last += 4
@@ -602,10 +671,11 @@ func Nb_basic(port)
call appendbufline(cmdbufnr, '$', 'specialKeys_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
let l = ReadXnetbeans()
- call assert_equal('send: 0:specialKeys!89 "F12 F13"', l[-1])
+ call assert_equal('send: 0:specialKeys!91 "F12 F13 C-F13"', l[-1])
sleep 1m
call assert_equal(':nbkey F12<CR>', maparg('<F12>', 'n'))
call assert_equal(':nbkey F13<CR>', maparg('<F13>', 'n'))
+ call assert_equal(':nbkey C-F13<CR>', maparg('<C-F13>', 'n'))
let g:last += 3
" Open a buffer not monitored by netbeans
@@ -626,17 +696,110 @@ func Nb_basic(port)
call WaitFor('len(ReadXnetbeans()) >= (g:last + 10)')
let g:last += 10
+ if has('mouse')
+ " Test for mouse button release
+ let save_mouse = &mouse
+ set mouse=a
+ call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt')
+ let &mouse = save_mouse
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 2)')
+ let l = ReadXnetbeans()
+ call assert_equal('4:newDotAndMark=93 0 0', l[-2])
+ call assert_equal('4:buttonRelease=93 0 1 -1', l[-1])
+ let g:last += 2
+ endif
+
+ " Test for startAtomic
+ call appendbufline(cmdbufnr, '$', 'startAtomic_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 0:startAtomic!94', l[-1])
+ let g:last += 3
+
+ " Test for endAtomic
+ call appendbufline(cmdbufnr, '$', 'endAtomic_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_equal('send: 0:endAtomic!95', l[-1])
+ let g:last += 3
+
+ " Test for invoking a netbeans key binding
+ let special_keys = [
+ \ ["\<F1>", 'F1'], ["\<S-F1>", 'S-F1'],
+ \ ["\<F2>", 'F2'], ["\<S-F2>", 'S-F2'],
+ \ ["\<F3>", 'F3'], ["\<S-F3>", 'S-F3'],
+ \ ["\<F4>", 'F4'], ["\<S-F4>", 'S-F4'],
+ \ ["\<F5>", 'F5'], ["\<S-F5>", 'S-F5'],
+ \ ["\<F6>", 'F6'], ["\<S-F6>", 'S-F6'],
+ \ ["\<F7>", 'F7'], ["\<S-F7>", 'S-F7'],
+ \ ["\<F8>", 'F8'], ["\<S-F8>", 'S-F8'],
+ \ ["\<F9>", 'F9'], ["\<S-F9>", 'S-F9'],
+ \ ["\<F11>", 'F11'], ["\<S-F11>", 'S-F11'],
+ \ ["\<F12>", 'F12'], ["\<S-F12>", 'S-F12'], ['!', '!']
+ \ ]
+ for [key, name] in special_keys
+ call feedkeys("\<F21>" .. key, 'xt')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_match('4:keyCommand=\d\+ "' .. name .. '"', l[-2])
+ call assert_match('4:keyAtPos=\d\+ "' .. name .. '" 0 1/0', l[-1])
+ let g:last += 3
+ endfor
+ call feedkeys("\<F21>\<C-S-M-F9>", 'xt')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
+ let l = ReadXnetbeans()
+ call assert_match('4:keyCommand=\d\+ "CSM-F9"', l[-2])
+ call assert_match('4:keyAtPos=\d\+ "CSM-F9" 0 1/0', l[-1])
+ let g:last += 3
+
+ if has('signs') && has('mouse')
+ sign define S1 linehl=Search text==>
+ sign define S2 linehl=ErrorMsg text=!!
+ sign place 10 line=1 name=S1
+ sign place 20 line=1 name=S2
+
+ let save_mouse = &mouse
+ set mouse=a
+ call assert_equal('S2', sign_getplaced()[0].signs[0].name)
+ call test_setmouse(1, 1)
+ call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt')
+ call assert_equal('S1', sign_getplaced()[0].signs[0].name)
+ call test_setmouse(1, 1)
+ call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt')
+ call assert_equal('S2', sign_getplaced()[0].signs[0].name)
+ let &mouse = save_mouse
+
+ sign unplace 10
+ sign unplace 20
+ sign undefine S1
+ sign undefine S2
+ endif
+
+ " define a large number of annotations
+ call appendbufline(cmdbufnr, '$', 'AnnoScale_Test')
+ call WaitFor('len(ReadXnetbeans()) >= (g:last + 26)')
+ let l = ReadXnetbeans()
+ call assert_equal('2:defineAnnoType!60 25 "s25" "x" "=>" blue none', l[-1])
+ sleep 1m
+ call assert_true(len(sign_getdefined()) >= 25)
+ let g:last += 26
+
" detach
call appendbufline(cmdbufnr, '$', 'detach_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 8)')
- call WaitForAssert({-> assert_equal('0:disconnect=93', ReadXnetbeans()[-1])})
+ call WaitForAssert({-> assert_equal('0:disconnect=97', ReadXnetbeans()[-1])})
" the connection was closed
call assert_false(has("netbeans_enabled"))
+ " Remove all the signs
+ call sign_unplace('*')
+ call sign_undefine()
+
call delete("Xnetbeans")
call delete('Xfile1')
call delete('Xfile3')
+ call delete('Xfile4')
endfunc
func Test_nb_basic()
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 88eabaa04..196aa1d8d 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -3949,6 +3949,10 @@ func Test_lhelpgrep_autocmd()
au BufEnter * call setqflist([], 'f')
augroup END
call assert_fails('helpgrep quickfix', 'E925:')
+ " run the test with a help window already open
+ help
+ wincmd w
+ call assert_fails('helpgrep quickfix', 'E925:')
augroup QF_Test
au! BufEnter
augroup END
diff --git a/src/version.c b/src/version.c
index 279837b67..7591c83d7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1942,
+/**/
1941,
/**/
1940,