Files
vim-ingo-library-mirror/tests/EchoLine.txt
Ingo Karkat 1757627de7 Tests: Add existing ingo-library tests
To be executed through my runVimTests testing framework.
2017-05-31 14:26:18 +02:00

122 lines
7.2 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
" vim: set ft=vim foldcolumn=0 :
if exists("g:loaded_test")
finish
endif
let g:loaded_test = 1
echomsg "this is testnew.vim"
setl foldcolumn=0
map <silent> ,x :call EchoWithoutScrolling#Echo(getline(line('.')))<CR>
map <silent> ,x :call EchoWithoutScrolling#Echo(EchoWithoutScrolling#TranslateLineBreaks(getline(line('.'))))<CR>
map <silent> ,z :call EchoLine#EchoLinePart( line('.'), col('.'),0,EchoWithoutScrolling#MaxLength(), [] )<CR>
map <silent> ,Z :call EchoLine#EchoLine( line('.'), col('.'),'prefix:', [] )<CR>
map <silent> ,c :call EchoLine#EchoLinePart( line('.'), col('.'),0,6, [] )<CR>
call EchoWithoutScrolling#Echo(getline(line(".")))
set noshowcmd
function! s:IndentConsistencyCop( startLineNum, endLineNum, isBufferSettingsCheck ) " {{{1
"*******************************************************************************
"* PURPOSE:
" Triggers the indent consistency check and presents the results to the user.
"* ASSUMPTIONS / PRECONDITIONS:
" ? List of any external variable, control, or other element whose state affects this procedure.
"* EFFECTS / POSTCONDITIONS:
" ? List of the procedure's effect on each external variable, control, or other element.
"* INPUTS:
" a:startLineNum, a:endLineNum: range in the current buffer that is to be
" checked.
" a:isBufferSettingsCheck: flag whether consistency with the buffer
" settings should also be checked.
"* RETURN VALUES:
" none
"*******************************************************************************
let l:isEntireBuffer = s:IsEntireBuffer(a:startLineNum, a:endLineNum)
let l:lineCnt = a:endLineNum - a:startLineNum + 1
call s:EchoStartupMessage( l:lineCnt, l:isEntireBuffer )
let s:occurrences = {}
let s:ratings = {}
let l:isConsistent = s:CheckBufferConsistency( a:startLineNum, a:endLineNum )
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, '' )
call s:ReportBufferSettingsConsistency('')
if l:isConsistent == -1
call s:ClearHighlighting()
call s:UnindentedBufferConsistencyCop( l:isEntireBuffer, a:isBufferSettingsCheck )
call s:ReportConsistencyWithBufferSettingsResult( l:isEntireBuffer, 1 )
elseif l:isConsistent == 0
if a:isBufferSettingsCheck
let l:isBufferConsistentWithBufferSettings = s:IsBufferConsistentWithBufferSettings( a:startLineNum, a:endLineNum )
call s:ReportConsistencyWithBufferSettingsResult( l:isEntireBuffer, l:isBufferConsistentWithBufferSettings )
if l:isBufferConsistentWithBufferSettings
call s:ClearHighlighting()
let l:consistentIndentSetting = s:GetIndentSettingForBufferSettings()
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, l:consistentIndentSetting ) " Update report, now that the verdict has been turned around and we have the consistent indent setting.
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, l:consistentIndentSetting, 0 ) " Pass isBufferSettingsCheck = 0 here (though a:isBufferSettingsCheck == 1) because we've already ensured that the buffer is consistent with the buffer settings.
else
let l:inconsistentIndentationMessage = 'Found ' . ( s:IsEnoughIndentForSolidAssessment() ? '' : 'potentially ')
let l:inconsistentIndentationMessage .= 'inconsistent indentation in this ' . s:GetScopeUserString(l:isEntireBuffer) . '; generated from these conflicting settings: '
let l:inconsistentIndentationMessage .= s:RatingsToUserString( l:lineCnt )
let l:inconsistentIndentationMessage .= s:GetInsufficientIndentUserMessage() " problems ahead
call s:IndentBufferInconsistencyCop( a:startLineNum, a:endLineNum, l:inconsistentIndentationMessage )
endif
endif
elseif l:isConsistent == 1
call s:ClearHighlighting()
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, s:perfectIndentSetting ) " Update report, now that we have the consistent (perfect) indent setting.
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, s:perfectIndentSetting, a:isBufferSettingsCheck )
else
throw 'assert false'
endif
"****D echo 'Consistent ? ' . l:isConsistent
"****D echo 'Occurrences: ' . string( s:occurrences )
"****D echo 'Nrm. Ratings: ' . string( s:ratings )
" Cleanup remaining dictionaries with script-scope to free memory.
let s:occurrences = {}
let s:ratings = {}
endfunction
" }}}1
Ich würde alles Übermäßig im Gebärmutterüberdruß á la §282 sehen.
日本abc語
ab日本cdef
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, l:consistentIndentSetting, 0 ) " Pass isBufferSettingsCheck = 0 here (though a:isBufferSettingsCheck == 1) because we've already ensured that the buffer is consistent with the buffer settings.
calls:IndentBufferConsistencyCop(a:startLineNum,a:endLineNum,l:consistentIndentSetting,0)"PassisBufferSettingsCheck=0here(thougha:isBufferSettingsCheck==1)becausewe'vealreadyensuredthatthebufferisconsistentwiththebuffersettings.
echomsg  "this is testnew.vim" a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
echomsg "this is 日本語 testnew インゴ  .vim"  a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
echo msg "this is 日本語 testnew インゴ  .vim"  a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
echo msg "this is 日本語 testnew インゴ  .vim"  a very long line echo msg "this is 日本語 testnew インゴ  .vim"  a very long line
日本語 日本語 日本語 日本語 日本語      日本語  インゴ   foobar
invisible foo
bar is not seen
hehe is the only clue
invisible foobar is not seenhehe is the only clue
foo
bar is not seenhehe is the only clue
hi SpecialKey guifg=cyan
"- commands --------------------------------------------------------------{{{1
" Ensure indent consistency within the range / buffer, and - if achieved -, also
" check consistency with buffer indent settings.
command! -bar -range=% -nargs=0 IndentConsistencyCop call <SID>IndentConsistencyCop( xx <line1>,xx <line2>, 1 ) |
command! -bar -range=% -nargs=0 IndentConsistencyCop call <SID>IndentConsistencyCop( <line1>, <line2>, 1 )
command! -bar -nargs=0 I 1234 call <SID>I(<line1>, <line2>, 1 )
syn match txt20colWarning /^.\{1,20}/
hi def link txt20colWarning WarningMsg
syn match txt80colError /\%81v.\+/
hi def link txt80colError Error
if
\))))))))))))))))))
foo bar
lala heeh
mand! -bar x x -nargs=0 I 1234 call <SID>I(<line1>, <line2>, 1 )
command! -bar -nNargs=0 I 1234 call <SID>I(<line1>, <line2>, 1 )
1 2 3 4 5 6 7 8 9 9
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890