Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–259 unchanged (259 lines)
260 let partial = dir[0:-2]
261 " Get the current drive letter and full path of the target dir
262 call chdir('/' .. dir)
263 let full = getcwd()
264 let drive = full[0]
265 call chdir(saved_cwd)
266
267 for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
268 for sep in [ '/', '\']
269
270 " Explicit drive letter
271 call feedkeys(':' .. cmd .. ' ' .. drive .. ':' .. sep ..
272 \ partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
273 call assert_match(full, @:)
274
275 " Implicit drive letter
276 call feedkeys(':' .. cmd .. ' ' .. sep .. partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
277 call assert_match('/' .. dir .. '/', @:)
278
279 " UNC path
280 call feedkeys(':' .. cmd .. ' ' .. sep .. sep .. $COMPUTERNAME .. sep ..
281 \ drive .. '$' .. sep .. partial .."\<C-A>\<C-B>\"\<CR>", 'tx')
282 call assert_match('//' .. $COMPUTERNAME .. '/' .. drive .. '$/' .. dir .. '/' , @:)
283
284 endfor
285 endfor
286 endif
287endfunc
288
…lines 289–390 unchanged (102 lines)

After

…lines 1–260 unchanged (260 lines)
261 " Get the current drive letter and full path of the target dir
262 call chdir('/' .. dir)
263 let full = getcwd()
264 let drive = full[0]
265 call chdir(saved_cwd)
266
267 " Spaces are escaped in command line completion. Next, in assert_match(),
268 " the backslash added by the first escape also needs to be escaped
269 " separately, so the escape is doubled.
270 let want_full = escape(escape(full, ' '), '\')
271 let want_dir = escape(escape(dir, ' '), '\')
272
273 for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
274 for sep in [ '/', '\']
275
276 " Explicit drive letter
277 call feedkeys(':' .. cmd .. ' ' .. drive .. ':' .. sep ..
278 \ partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
279 call assert_match(want_full, @:)
280
281 " Implicit drive letter
282 call feedkeys(':' .. cmd .. ' ' .. sep .. partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
283 call assert_match('/' .. want_dir .. '/', @:)
284
285 " UNC path
286 call feedkeys(':' .. cmd .. ' ' .. sep .. sep .. $COMPUTERNAME .. sep ..
287 \ drive .. '$' .. sep .. partial .."\<C-A>\<C-B>\"\<CR>", 'tx')
288 call assert_match('//' .. $COMPUTERNAME .. '/' .. drive .. '$/' .. want_dir .. '/' , @:)
289
290 endfor
291 endfor
292 endif
293endfunc
294
…lines 295–396 unchanged (102 lines)

Before

script_file
comment "\" Test for :cd and chdir()"
source_statement
source "source"
filename "shared.vim"
source_statement
source "source"
filename "check.vim"
function_definition (+28 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+97 nodes collapsed)
function_definition (+191 nodes collapsed)
comment "\" Test for chdir()"
function_definition (+508 nodes collapsed)
comment "\" Test for changing to the previous directory '-'"
function_definition (+350 nodes collapsed)
function_definition (+43 nodes collapsed)
function_definition (+80 nodes collapsed)
function_definition
function "func"
function_declaration
identifier "Test_cd_completion"
parameters
( "("
) ")"
body
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'XComplDir1'"
, ","
string_literal "'D'"
) ")"
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'XComplDir2'"
, ","
string_literal "'D'"
) ")"
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'sub/XComplDir3'"
, ","
string_literal "'pD'"
) ")"
call_statement
call "call"
call_expression
identifier "writefile"
( "("
list
[ "["
] "]"
, ","
string_literal "'XComplFile'"
, ","
string_literal "'D'"
) ")"
for_loop (+50 nodes collapsed)
set_statement
set "set"
set_item
option_name "cdpath"
+= "+="
set_value "sub"
for_loop (+50 nodes collapsed)
set_statement
set "set"
set_item
default_option
option_name "cdpath"
& "&"
if_statement
if "if"
call_expression
identifier "has"
( "("
string_literal "'win32'"
) ")"
body
comment "\" Test Windows absolute path completion"
let_statement
let "let"
identifier "saved_cwd"
= "="
call_expression
identifier "getcwd"
( "("
) ")"
comment "\" Retrieve a suitable dir in the current drive"
for_loop (+68 nodes collapsed)
if_statement
if "if"
unary_operation
! "!"
call_expression
identifier "exists"
( "("
string_literal "'dir'"
) ")"
body
throw_statement
throw "throw"
string_literal "'Skipped: no testable directories found in the current drive"...
endif "endif"
comment "\" Get partial path"
let_statement
let "let"
identifier "partial"
= "="
slice_expression
identifier "dir"
[ "["
integer_literal "0"
: ":"
integer_literal "-2"
] "]"
comment "\" Get the current drive letter and full path of the target d"...
call_statement
call "call"
call_expression
identifier "chdir"
( "("
binary_operation
string_literal "'/'"
.. ".."
identifier "dir"
) ")"
let_statement
let "let"
identifier "full"
= "="
call_expression
identifier "getcwd"
( "("
) ")"
let_statement
let "let"
identifier "drive"
= "="
index_expression
identifier "full"
[ "["
integer_literal "0"
] "]"
call_statement
call "call"
call_expression
identifier "chdir"
( "("
identifier "saved_cwd"
) ")"
for_loop
for "for"
identifier "cmd"
in "in"
list
[ "["
string_literal "'cd'"
, ","
string_literal "'chdir'"
, ","
string_literal "'lcd'"
, ","
string_literal "'lchdir'"
, ","
string_literal "'tcd'"
, ","
string_literal "'tchdir'"
] "]"
body
for_loop
for "for"
identifier "sep"
in "in"
list
[ "["
string_literal "'/'"
, ","
string_literal "'\\'"
] "]"
body
comment "\" Explicit drive letter"
call_statement (+30 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
identifier "full"
, ","
register "@:"
) ")"
comment "\" Implicit drive letter"
call_statement (+24 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
binary_operation
binary_operation
string_literal "'/'"
.. ".."
identifier "dir"
.. ".."
string_literal "'/'"
, ","
register "@:"
) ")"
comment "\" UNC path"
call_statement (+44 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
binary_operation
binary_operation
binary_operation
binary_operation
binary_operation
binary_operation
string_literal "'//'"
.. ".."
env_variable
$ "$"
identifier "COMPUTERNAME"
.. ".."
string_literal "'/'"
.. ".."
identifier "drive"
.. ".."
string_literal "'$/'"
.. ".."
identifier "dir"
.. ".."
string_literal "'/'"
, ","
register "@:"
) ")"
endfor "endfor"
endfor "endfor"
endif "endif"
endfunction "endfunc"
function_definition (+88 nodes collapsed)
function_definition (+121 nodes collapsed)
function_definition (+172 nodes collapsed)
function_definition (+152 nodes collapsed)
comment "\" vim: shiftwidth=2 sts=2 expandtab"

After

script_file
comment "\" Test for :cd and chdir()"
source_statement
source "source"
filename "shared.vim"
source_statement
source "source"
filename "check.vim"
function_definition (+28 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+97 nodes collapsed)
function_definition (+191 nodes collapsed)
comment "\" Test for chdir()"
function_definition (+508 nodes collapsed)
comment "\" Test for changing to the previous directory '-'"
function_definition (+350 nodes collapsed)
function_definition (+43 nodes collapsed)
function_definition (+80 nodes collapsed)
function_definition
function "func"
function_declaration
identifier "Test_cd_completion"
parameters
( "("
) ")"
body
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'XComplDir1'"
, ","
string_literal "'D'"
) ")"
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'XComplDir2'"
, ","
string_literal "'D'"
) ")"
call_statement
call "call"
call_expression
identifier "mkdir"
( "("
string_literal "'sub/XComplDir3'"
, ","
string_literal "'pD'"
) ")"
call_statement
call "call"
call_expression
identifier "writefile"
( "("
list
[ "["
] "]"
, ","
string_literal "'XComplFile'"
, ","
string_literal "'D'"
) ")"
for_loop (+50 nodes collapsed)
set_statement
set "set"
set_item
option_name "cdpath"
+= "+="
set_value "sub"
for_loop (+50 nodes collapsed)
set_statement
set "set"
set_item
default_option
option_name "cdpath"
& "&"
if_statement
if "if"
call_expression
identifier "has"
( "("
string_literal "'win32'"
) ")"
body
comment "\" Test Windows absolute path completion"
let_statement
let "let"
identifier "saved_cwd"
= "="
call_expression
identifier "getcwd"
( "("
) ")"
comment "\" Retrieve a suitable dir in the current drive"
for_loop (+68 nodes collapsed)
if_statement
if "if"
unary_operation
! "!"
call_expression
identifier "exists"
( "("
string_literal "'dir'"
) ")"
body
throw_statement
throw "throw"
string_literal "'Skipped: no testable directories found in the current drive"...
endif "endif"
comment "\" Get partial path"
let_statement
let "let"
identifier "partial"
= "="
slice_expression
identifier "dir"
[ "["
integer_literal "0"
: ":"
integer_literal "-2"
] "]"
comment "\" Get the current drive letter and full path of the target d"...
call_statement
call "call"
call_expression
identifier "chdir"
( "("
binary_operation
string_literal "'/'"
.. ".."
identifier "dir"
) ")"
let_statement
let "let"
identifier "full"
= "="
call_expression
identifier "getcwd"
( "("
) ")"
let_statement
let "let"
identifier "drive"
= "="
index_expression
identifier "full"
[ "["
integer_literal "0"
] "]"
call_statement
call "call"
call_expression
identifier "chdir"
( "("
identifier "saved_cwd"
) ")"
comment "\" Spaces are escaped in command line completion. Next, in as"...
comment "\" the backslash added by the first escape also needs to be e"...
comment "\" separately, so the escape is doubled."
let_statement
let "let"
identifier "want_full"
= "="
call_expression
identifier "escape"
( "("
call_expression
identifier "escape"
( "("
identifier "full"
, ","
string_literal "' '"
) ")"
, ","
string_literal "'\\'"
) ")"
let_statement
let "let"
identifier "want_dir"
= "="
call_expression
identifier "escape"
( "("
call_expression
identifier "escape"
( "("
identifier "dir"
, ","
string_literal "' '"
) ")"
, ","
string_literal "'\\'"
) ")"
for_loop
for "for"
identifier "cmd"
in "in"
list
[ "["
string_literal "'cd'"
, ","
string_literal "'chdir'"
, ","
string_literal "'lcd'"
, ","
string_literal "'lchdir'"
, ","
string_literal "'tcd'"
, ","
string_literal "'tchdir'"
] "]"
body
for_loop
for "for"
identifier "sep"
in "in"
list
[ "["
string_literal "'/'"
, ","
string_literal "'\\'"
] "]"
body
comment "\" Explicit drive letter"
call_statement (+30 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
identifier "want_full"
, ","
register "@:"
) ")"
comment "\" Implicit drive letter"
call_statement (+24 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
binary_operation
binary_operation
string_literal "'/'"
.. ".."
identifier "want_dir"
.. ".."
string_literal "'/'"
, ","
register "@:"
) ")"
comment "\" UNC path"
call_statement (+44 nodes collapsed)
call_statement
call "call"
call_expression
identifier "assert_match"
( "("
binary_operation
binary_operation
binary_operation
binary_operation
binary_operation
binary_operation
string_literal "'//'"
.. ".."
env_variable
$ "$"
identifier "COMPUTERNAME"
.. ".."
string_literal "'/'"
.. ".."
identifier "drive"
.. ".."
string_literal "'$/'"
.. ".."
identifier "want_dir"
.. ".."
string_literal "'/'"
, ","
register "@:"
) ")"
endfor "endfor"
endfor "endfor"
endif "endif"
endfunction "endfunc"
function_definition (+88 nodes collapsed)
function_definition (+121 nodes collapsed)
function_definition (+172 nodes collapsed)
function_definition (+152 nodes collapsed)
comment "\" vim: shiftwidth=2 sts=2 expandtab"