vim-patch:9.1.0120: hard to get visual region using Vim script

Problem:  hard to get visual region using Vim script
Solution: Add getregion() Vim script function
          (Shougo Matsushita, Jakub Łuczyński)

closes: vim/vim#13998
closes: vim/vim#11579

3f905ab3c4

Cherry-pick changes from patch 9.1.0122, with :echom instead of :echow.

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
This commit is contained in:
zeertzjq
2024-02-22 20:32:52 +08:00
parent bb15fa0356
commit 20e4001eee
8 changed files with 500 additions and 78 deletions

View File

@@ -15,6 +15,25 @@
#include "nvim/pos_defs.h"
#include "nvim/types_defs.h"
/// structure used by block_prep, op_delete and op_yank for blockwise operators
/// also op_change, op_shift, op_insert, op_replace - AKelly
struct block_def {
int startspaces; ///< 'extra' cols before first char
int endspaces; ///< 'extra' cols after last char
int textlen; ///< chars in block
char *textstart; ///< pointer to 1st char (partially) in block
colnr_T textcol; ///< index of chars (partially) in block
colnr_T start_vcol; ///< start col of 1st char wholly inside block
colnr_T end_vcol; ///< start col of 1st char wholly after block
int is_short; ///< true if line is too short to fit in block
int is_MAX; ///< true if curswant==MAXCOL when starting
int is_oneChar; ///< true if block within one character
int pre_whitesp; ///< screen cols of ws before block
int pre_whitesp_c; ///< chars of ws before block
colnr_T end_char_vcols; ///< number of vcols of post-block char
colnr_T start_char_vcols; ///< number of vcols of pre-block char
};
typedef int (*Indenter)(void);
/// flags for do_put()