From 0313efa06f009d1bb814c115b11bb0afa7f2db4d Mon Sep 17 00:00:00 2001 From: dsych Date: Fri, 19 Feb 2021 23:44:20 -0500 Subject: [PATCH] removing redundant check for array bounds --- python3/vimspector/utils.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/python3/vimspector/utils.py b/python3/vimspector/utils.py index 287f919..d03a344 100644 --- a/python3/vimspector/utils.py +++ b/python3/vimspector/utils.py @@ -34,13 +34,6 @@ _log_handler = logging.FileHandler( LOG_FILE, mode = 'w' ) _log_handler.setFormatter( logging.Formatter( '%(asctime)s - %(levelname)s - %(message)s' ) ) -# this is the "large number" that vim returns for col num, when getting '> mark -# with getpos() for line wise visual selection(V) -# see https://github.com/vim/vim/blob/eed9d46293f0842aad0d50ff3a526f9a48b12421/src/evalfunc.c#L4077 -# and https://github.com/vim/vim/blob/064095012c0b8e4e43e75834b337115950898fbf/src/vim.h#L1699 -MAX_COL = 2147483647 - - def SetUpLogging( logger ): logger.setLevel( logging.DEBUG ) if _log_handler not in logger.handlers: @@ -739,9 +732,7 @@ def GetVisualSelection( bufnr ): # don't as me why... lines = vim.buffers[ bufnr ][ start_line - 1 : end_line ] lines[ 0 ] = lines[ 0 ][ start_col : ] - # only trim the end if we are not in line-wise select mode - if( end_col < MAX_COL ): - lines[ -1 ] = lines[ -1 ][ : end_col + 1 ] + lines[ -1 ] = lines[ -1 ][ : end_col + 1 ] return lines