aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2019-10-01 23:14:00 +0900
committerMatthieu Coudron <mattator@gmail.com>2019-12-03 13:31:17 +0100
commit3beef8ee1ca9699d75b8877ec9b77493b58b0ed4 (patch)
tree51141b1b430920f6925e178905228e019d21fc79
parent1ff5b60cb96aea3b3f6ef9e2792c5797dfda72dc (diff)
downloadrneovim-3beef8ee1ca9699d75b8877ec9b77493b58b0ed4.tar.gz
rneovim-3beef8ee1ca9699d75b8877ec9b77493b58b0ed4.tar.bz2
rneovim-3beef8ee1ca9699d75b8877ec9b77493b58b0ed4.zip
defaults: set nostartofline
Having the cursor change column can be surprising. Force startofline in functional and old tests. Remove the functional breakindent test, as it's a subset of the oldtest one.
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--src/nvim/options.lua4
-rw-r--r--src/nvim/testdir/setup.vim1
-rw-r--r--test/functional/helpers.lua2
-rw-r--r--test/functional/legacy/breakindent_spec.lua214
6 files changed, 6 insertions, 218 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 386fcdf8c0..30aebfc5ff 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5746,7 +5746,7 @@ A jump table for the options with a short description can be found at |Q_op|.
current one. |:vsplit|
*'startofline'* *'sol'* *'nostartofline'* *'nosol'*
-'startofline' 'sol' boolean (default on)
+'startofline' 'sol' boolean (default off)
global
When "on" the commands listed below move the cursor to the first
non-blank of the line. When off the cursor is kept in the same column
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 4267aefbbf..3646034dba 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -55,6 +55,7 @@ the differences.
- 'showcmd' is enabled
- 'sidescroll' defaults to 1
- 'smarttab' is enabled
+- 'startofline' is disabled
- 'tabpagemax' defaults to 50
- 'tags' defaults to "./tags;,tags"
- 'ttimeoutlen' defaults to 50
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index d20174466d..903b7e982a 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -2323,9 +2323,9 @@ return {
full_name='startofline', abbreviation='sol',
type='bool', scope={'global'},
vi_def=true,
- vim=true,
+ vim=false,
varname='p_sol',
- defaults={if_true={vi=true}}
+ defaults={if_true={vi=false}}
},
{
full_name='statusline', abbreviation='stl',
diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim
index ea28f328ae..d032c9a739 100644
--- a/src/nvim/testdir/setup.vim
+++ b/src/nvim/testdir/setup.vim
@@ -19,6 +19,7 @@ set sidescroll=0
set tags=./tags,tags
set undodir^=.
set wildoptions=
+set startofline
" Prevent Nvim log from writing to stderr.
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 1108fbb2ba..9fcd1cf7b1 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -35,7 +35,7 @@ module.nvim_prog = (
)
-- Default settings for the test session.
module.nvim_set = (
- 'set shortmess+=IS background=light noswapfile noautoindent'
+ 'set shortmess+=IS background=light noswapfile noautoindent startofline'
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
..' belloff= wildoptions-=pum noshowcmd noruler nomore redrawdebug=invalid')
module.nvim_argv = {
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
deleted file mode 100644
index fd25e809e0..0000000000
--- a/test/functional/legacy/breakindent_spec.lua
+++ /dev/null
@@ -1,214 +0,0 @@
--- Test for breakindent
-
-local helpers = require('test.functional.helpers')(after_each)
-local feed, insert = helpers.feed, helpers.insert
-local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
-
-describe('breakindent', function()
- setup(clear)
-
- -- luacheck: ignore 621 (Indentation)
- -- luacheck: ignore 613 (Trailing whitespace in a string)
- -- luacheck: ignore 611 (Line contains only whitespaces)
- it('is working', function()
- insert('dummy text')
-
- feed_command('set wildchar=^E')
- feed_command('10new')
- feed_command('vsp')
- feed_command('vert resize 20')
- feed_command([[put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"]])
- feed_command('set ts=4 sw=4 sts=4 breakindent')
- feed_command('fu! ScreenChar(line, width)')
- feed_command(' let c=""')
- feed_command(' for i in range(1,a:width)')
- feed_command(' let c.=nr2char(screenchar(a:line, i))')
- feed_command(' endfor')
- feed_command([[ let c.="\n"]])
- feed_command(' for i in range(1,a:width)')
- feed_command(' let c.=nr2char(screenchar(a:line+1, i))')
- feed_command(' endfor')
- feed_command([[ let c.="\n"]])
- feed_command(' for i in range(1,a:width)')
- feed_command(' let c.=nr2char(screenchar(a:line+2, i))')
- feed_command(' endfor')
- feed_command(' return c')
- feed_command('endfu')
- feed_command('fu DoRecordScreen()')
- feed_command(' wincmd l')
- feed_command([[ $put =printf(\"\n%s\", g:test)]])
- feed_command(' $put =g:line1')
- feed_command(' wincmd p')
- feed_command('endfu')
- feed_command('set briopt=min:0')
- feed_command('let g:test="Test 1: Simple breakindent"')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test="Test 2: Simple breakindent + sbr=>>"')
- feed_command('set sbr=>>')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test ="Test 3: Simple breakindent + briopt:sbr"')
- feed_command('set briopt=sbr,min:0 sbr=++')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test ="Test 4: Simple breakindent + min width: 18"')
- feed_command('set sbr= briopt=min:18')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test =" Test 5: Simple breakindent + shift by 2"')
- feed_command('set briopt=shift:2,min:0')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test=" Test 6: Simple breakindent + shift by -1"')
- feed_command('set briopt=shift:-1,min:0')
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"')
- feed_command('set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
- feed_command('let line1=ScreenChar(line("."),10)')
- feed_command('call DoRecordScreen()')
- feed_command('let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"')
- feed_command('set briopt=shift:1,sbr,min:0 nu sbr=# list lcs&vi')
- feed_command('let line1=ScreenChar(line("."),10)')
- feed_command('call DoRecordScreen()')
- feed_command([[let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"]])
- feed_command('set briopt-=sbr')
- feed_command('let line1=ScreenChar(line("."),10)')
- feed_command('call DoRecordScreen()')
- feed_command([[let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"]])
- feed_command('set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
- feed_command('let line1=ScreenChar(line("."),10)')
- feed_command('call DoRecordScreen()')
- feed_command('wincmd p')
- feed_command([[let g:test="\n Test 11: strdisplaywidth when breakindent is on"]])
- feed_command('set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
- -- Skip leading tab when calculating text width.
- feed_command('let text=getline(2)')
- -- Text wraps 3 times.
- feed_command('let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3')
- feed_command('$put =g:test')
- feed_command([[$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)]])
- feed_command([[let g:str="\t\t\t\t\t{"]])
- feed_command('let g:test=" Test 12: breakindent + long indent"')
- feed_command('wincmd p')
- feed_command('set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4')
- feed_command('$put =g:str')
- feed('zt')
- feed_command('let line1=ScreenChar(1,10)')
- feed_command('wincmd p')
- feed_command('call DoRecordScreen()')
-
- -- Test, that the string " a\tb\tc\td\te" is correctly displayed in a
- -- 20 column wide window (see bug report
- -- https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ ).
- feed_command('only')
- feed_command('vert 20new')
- feed_command('set all& breakindent briopt=min:10')
- feed_command([[call setline(1, [" a\tb\tc\td\te", " z y x w v"])]])
- feed_command([[/^\s*a]])
- feed('fbgjyl')
- feed_command('let line1 = @0')
- feed_command([[?^\s*z]])
- feed('fygjyl')
- feed_command('let line2 = @0')
- feed_command('quit!')
- feed_command([[$put ='Test 13: breakindent with wrapping Tab']])
- feed_command('$put =line1')
- feed_command('$put =line2')
-
- feed_command('let g:test="Test 14: breakindent + visual blockwise delete #1"')
- feed_command('set all& breakindent shada+=nX-test-breakindent.shada')
- feed_command('30vnew')
- feed_command('normal! 3a1234567890')
- feed_command('normal! a abcde')
- feed_command([[exec "normal! 0\<C-V>tex"]])
- feed_command('let line1=ScreenChar(line("."),8)')
- feed_command('call DoRecordScreen()')
-
- feed_command('let g:test="Test 15: breakindent + visual blockwise delete #2"')
- feed_command('%d')
- feed_command('normal! 4a1234567890')
- feed_command([[exec "normal! >>\<C-V>3f0x"]])
- feed_command('let line1=ScreenChar(line("."),20)')
- feed_command('call DoRecordScreen()')
- feed_command('quit!')
-
- -- Assert buffer contents.
- expect([[
-
- abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
-
- Test 1: Simple breakindent
- abcd
- qrst
- GHIJ
-
- Test 2: Simple breakindent + sbr=>>
- abcd
- >>qr
- >>EF
-
- Test 3: Simple breakindent + briopt:sbr
- abcd
- ++ qrst
- ++ GHIJ
-
- Test 4: Simple breakindent + min width: 18
- abcd
- qrstuv
- IJKLMN
-
- Test 5: Simple breakindent + shift by 2
- abcd
- qr
- EF
-
- Test 6: Simple breakindent + shift by -1
- abcd
- qrstu
- HIJKL
-
- Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
- 2 ab
- ? m
- ? x
-
- Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
- 2 ^Iabcd
- # opq
- # BCD
-
- Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
- 2 ^Iabcd
- #op
- #AB
-
- Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
- 2 ab
- ~ mn
- ~ yz
-
- Test 11: strdisplaywidth when breakindent is on
- strdisplaywidth: 46 == calculated: 64
- {
-
- Test 12: breakindent + long indent
- 56
-
- ~
- Test 13: breakindent with wrapping Tab
- d
- w
-
- Test 14: breakindent + visual blockwise delete #1
- e
- ~
- ~
-
- Test 15: breakindent + visual blockwise delete #2
- 1234567890
- ~
- ~ ]])
- end)
-end)