runtime(termdebug): properly check mapping variables using null_dict Commit: https://github.com/vim/vim/commit/a5af73ae347f9d562524fbcfea3eb5cfeecefa46 Author: shane.xb.qian <shane.q...@foxmail.com> Date: Sun Jun 16 16:43:44 2024 +0200
runtime(termdebug): properly check mapping variables using null_dict closes: https://github.com/vim/vim/issues/15013 Signed-off-by: shane.xb.qian <shane.q...@foxmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 5bde69a44..d24ae578c 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -4,7 +4,7 @@ vim9script # Author: Bram Moolenaar # Copyright: Vim license applies, see ":help license" -# Last Change: 2024 Jun 14 +# Last Change: 2024 Jun 16 # Converted to Vim9: Ubaldo Tiberi <ubaldo.tib...@gmail.com> # WORK IN PROGRESS - The basics works stable, more to come @@ -194,9 +194,9 @@ def InitScriptVariables() winbar_winids = [] - k_map_saved = {} - plus_map_saved = {} - minus_map_saved = {} + k_map_saved = null_dict + plus_map_saved = null_dict + minus_map_saved = null_dict if has('menu') saved_mousemodel = null_string @@ -1232,32 +1232,38 @@ def DeleteCommands() delcommand Var delcommand Winbar - if exists('k_map_saved') - if !empty(k_map_saved) && !k_map_saved.buffer + if k_map_saved isnot null_dict + if !empty(k_map_saved) && k_map_saved.buffer + # pass + elseif !empty(k_map_saved) && !k_map_saved.buffer nunmap K mapset(k_map_saved) elseif empty(k_map_saved) - nunmap K + silent! nunmap K endif - k_map_saved = {} + k_map_saved = null_dict endif - if exists('plus_map_saved') - if !empty(plus_map_saved) && !plus_map_saved.buffer + if plus_map_saved isnot null_dict + if !empty(plus_map_saved) && plus_map_saved.buffer + # pass + elseif !empty(plus_map_saved) && !plus_map_saved.buffer nunmap + mapset(plus_map_saved) elseif empty(plus_map_saved) - nunmap + + silent! nunmap + endif - plus_map_saved = {} + plus_map_saved = null_dict endif - if exists('minus_map_saved') - if !empty(minus_map_saved) && !minus_map_saved.buffer + if minus_map_saved isnot null_dict + if !empty(minus_map_saved) && minus_map_saved.buffer + # pass + elseif !empty(minus_map_saved) && !minus_map_saved.buffer nunmap - mapset(minus_map_saved) elseif empty(minus_map_saved) - nunmap - + silent! nunmap - endif - minus_map_saved = {} + minus_map_saved = null_dict endif if has('menu') -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sIrMV-00GcYD-Ok%40256bit.org.