removing redundant check for array bounds

This commit is contained in:
dsych 2021-02-19 23:44:20 -05:00 committed by Ben Jackson
commit 0313efa06f

View file

@ -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