def get_selected_text(self, vi_cmd_data):
        fragments = [self.view.substr(r) for r in list(self.view.sel())]

        # Add new line at EOF, but don't add too many new lines.
        if (vi_cmd_data._synthetize_new_line_at_eof and
           not vi_cmd_data._yanks_linewise):
            if (not fragments[-1].endswith('\n') and
                # XXX: It appears regions can end beyond the buffer's EOF (?).
               self.view.sel()[-1].b >= self.view.size()):
                    fragments[-1] += '\n'

        if fragments and vi_cmd_data._yanks_linewise:
            for i, f in enumerate(fragments):
                # When should we add a newline character?
                #  * always except when we have a non-\n-only string followed
                # by a newline char.
                if (not f.endswith('\n')) or f.endswith('\n\n'):
                    fragments[i] = f + '\n'
        return fragments
Inspect settings and populate registers as needed.
dataset/ETHPy150Open guillermooo/Vintageous/vi/registers.py/Registers.get_selected_text