def navigate(self, cols):
        """Jump number of columns provided.

        Parameters
        ==========
        cols (integer)
            represents how many columns the cursor should be
            moved; the signal of the integer indicates the
            direction of the movement.
        """
        ### obtain new column number by adding up the current
        ### column number with the given number of columns
        ### to jump
        new_col = self.col + cols

        ### clamp the new colum number so it's within
        ### the length of the line;
        ###
        ### that is, the cursor can sit from 0 to the length
        ### of the line;
        ###
        ### note that this means the cursor can either sit
        ### on top of a character in the line but also after
        ### the last character or at the beginning of the
        ### line when the line is empty

        max_col_index = len(self.line)

        self.col = max(min(max_col_index, new_col), 0)

        ### admin task: snap cursor to new column we just
        ### defined

        ## try retrieving character sitting at the column we
        ## just defined
        try:
            char_obj = self.line[self.col]

        ## if an IndexError occurs, it means that there is
        ## no character where the cursor sits, so we
        ## check which specific situation caused this

        except IndexError:

            ## it may be caused by the cursor moving to the
            ## right of the last character

            if (
                # line is not empty
                max_col_index
                # and index is an unit after the last index
                and self.col == max_col_index
            ):

                # if this is the case, we just position the
                # cursor at the right of the last character
                # (the one sitting at the column before the
                # current one)

                char_obj = self.line[self.col - 1]
                self.rect.topleft = char_obj.rect.topright

            ## in all other scenarios we assume the line is
            ## empty, so we just place the cursor at the
            ## beginning of the line
            else:
                self.rect.topleft = self.line.rect.topleft

        ## if we otherwise succeed in retrieving the char
        ## in the current column, we move the cursor to the
        ## position of that character object;
        ##
        ## we also update the cursor size to that of the
        ## character obj

        else:

            self.rect.topleft = char_obj.rect.topleft
            self.rect.size = char_obj.rect.size
Jump number of columns provided.

        Parameters
        ==========
        cols (integer)
            represents how many columns the cursor should be
            moved; the signal of the integer indicates the
            direction of the movement.
        
nodezator/textman/entryedition/cursor.py