forked from aniani/vim
updated for version 7.3.221
Problem: Text from the clipboard is sometimes handled as linewise, but not consistently. Solution: Assume the text is linewise when it ends in a CR or NL.
This commit is contained in:
@@ -1173,7 +1173,7 @@ selection_received_cb(GtkWidget *widget UNUSED,
|
|||||||
char_u *tmpbuf = NULL;
|
char_u *tmpbuf = NULL;
|
||||||
guchar *tmpbuf_utf8 = NULL;
|
guchar *tmpbuf_utf8 = NULL;
|
||||||
int len;
|
int len;
|
||||||
int motion_type;
|
int motion_type = MAUTO;
|
||||||
|
|
||||||
if (data->selection == clip_plus.gtk_sel_atom)
|
if (data->selection == clip_plus.gtk_sel_atom)
|
||||||
cbd = &clip_plus;
|
cbd = &clip_plus;
|
||||||
@@ -1182,7 +1182,6 @@ selection_received_cb(GtkWidget *widget UNUSED,
|
|||||||
|
|
||||||
text = (char_u *)data->data;
|
text = (char_u *)data->data;
|
||||||
len = data->length;
|
len = data->length;
|
||||||
motion_type = MCHAR;
|
|
||||||
|
|
||||||
if (text == NULL || len <= 0)
|
if (text == NULL || len <= 0)
|
||||||
{
|
{
|
||||||
|
@@ -4671,7 +4671,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
|||||||
if (flavor)
|
if (flavor)
|
||||||
type = **textOfClip;
|
type = **textOfClip;
|
||||||
else
|
else
|
||||||
type = (strchr(*textOfClip, '\r') != NULL) ? MLINE : MCHAR;
|
type = MAUTO;
|
||||||
|
|
||||||
tempclip = lalloc(scrapSize + 1, TRUE);
|
tempclip = lalloc(scrapSize + 1, TRUE);
|
||||||
mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
|
mch_memmove(tempclip, *textOfClip + flavor, scrapSize);
|
||||||
|
18
src/ops.c
18
src/ops.c
@@ -5733,7 +5733,9 @@ clip_get_selection(cbd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert from the GUI selection string into the '*'/'+' register */
|
/*
|
||||||
|
* Convert from the GUI selection string into the '*'/'+' register.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
clip_yank_selection(type, str, len, cbd)
|
clip_yank_selection(type, str, len, cbd)
|
||||||
int type;
|
int type;
|
||||||
@@ -6090,9 +6092,6 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
|
|||||||
if (yank_type == MBLOCK)
|
if (yank_type == MBLOCK)
|
||||||
yank_type = MAUTO;
|
yank_type = MAUTO;
|
||||||
#endif
|
#endif
|
||||||
if (yank_type == MAUTO)
|
|
||||||
yank_type = ((len > 0 && (str[len - 1] == '\n' || str[len - 1] == '\r'))
|
|
||||||
? MLINE : MCHAR);
|
|
||||||
str_to_reg(y_current, yank_type, str, len, block_len);
|
str_to_reg(y_current, yank_type, str, len, block_len);
|
||||||
|
|
||||||
# ifdef FEAT_CLIPBOARD
|
# ifdef FEAT_CLIPBOARD
|
||||||
@@ -6113,13 +6112,14 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
|
|||||||
* is appended.
|
* is appended.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
str_to_reg(y_ptr, type, str, len, blocklen)
|
str_to_reg(y_ptr, yank_type, str, len, blocklen)
|
||||||
struct yankreg *y_ptr; /* pointer to yank register */
|
struct yankreg *y_ptr; /* pointer to yank register */
|
||||||
int type; /* MCHAR, MLINE or MBLOCK */
|
int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */
|
||||||
char_u *str; /* string to put in register */
|
char_u *str; /* string to put in register */
|
||||||
long len; /* length of string */
|
long len; /* length of string */
|
||||||
long blocklen; /* width of Visual block */
|
long blocklen; /* width of Visual block */
|
||||||
{
|
{
|
||||||
|
int type; /* MCHAR, MLINE or MBLOCK */
|
||||||
int lnum;
|
int lnum;
|
||||||
long start;
|
long start;
|
||||||
long i;
|
long i;
|
||||||
@@ -6136,6 +6136,12 @@ str_to_reg(y_ptr, type, str, len, blocklen)
|
|||||||
if (y_ptr->y_array == NULL) /* NULL means empty register */
|
if (y_ptr->y_array == NULL) /* NULL means empty register */
|
||||||
y_ptr->y_size = 0;
|
y_ptr->y_size = 0;
|
||||||
|
|
||||||
|
if (yank_type == MAUTO)
|
||||||
|
type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
|
||||||
|
? MLINE : MCHAR);
|
||||||
|
else
|
||||||
|
type = yank_type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count the number of lines within the string
|
* Count the number of lines within the string
|
||||||
*/
|
*/
|
||||||
|
@@ -2232,7 +2232,7 @@ clip_mch_lose_selection(VimClipboard *cbd)
|
|||||||
void
|
void
|
||||||
clip_mch_request_selection(VimClipboard *cbd)
|
clip_mch_request_selection(VimClipboard *cbd)
|
||||||
{
|
{
|
||||||
int type = MCHAR;
|
int type = MAUTO;
|
||||||
char_u *pAllocated = NULL;
|
char_u *pAllocated = NULL;
|
||||||
char_u *pClipText = NULL;
|
char_u *pClipText = NULL;
|
||||||
int clip_data_format = 0;
|
int clip_data_format = 0;
|
||||||
@@ -2280,14 +2280,12 @@ clip_mch_request_selection(VimClipboard *cbd)
|
|||||||
{
|
{
|
||||||
clip_data_format = CF_TEXT;
|
clip_data_format = CF_TEXT;
|
||||||
pClipText = pAllocated;
|
pClipText = pAllocated;
|
||||||
type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL)
|
else if ((pAllocated = Win16GetClipboardData(CF_OEMTEXT)) != NULL)
|
||||||
{
|
{
|
||||||
clip_data_format = CF_OEMTEXT;
|
clip_data_format = CF_OEMTEXT;
|
||||||
pClipText = pAllocated;
|
pClipText = pAllocated;
|
||||||
type = (vim_strchr((char*)pClipText, '\r') != NULL) ? MLINE : MCHAR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did we get anything? */
|
/* Did we get anything? */
|
||||||
|
@@ -1410,9 +1410,9 @@ clip_mch_request_selection(VimClipboard *cbd)
|
|||||||
{
|
{
|
||||||
char_u *temp_clipboard;
|
char_u *temp_clipboard;
|
||||||
|
|
||||||
/* If the type is not known guess it. */
|
/* If the type is not known detect it. */
|
||||||
if (metadata.type == -1)
|
if (metadata.type == -1)
|
||||||
metadata.type = (vim_strchr(str, '\n') == NULL) ? MCHAR : MLINE;
|
metadata.type = MAUTO;
|
||||||
|
|
||||||
/* Translate <CR><NL> into <NL>. */
|
/* Translate <CR><NL> into <NL>. */
|
||||||
temp_clipboard = crnl_to_nl(str, &str_size);
|
temp_clipboard = crnl_to_nl(str, &str_size);
|
||||||
|
@@ -93,7 +93,7 @@ clip_mch_request_selection( VimClipboard *cbd )
|
|||||||
clip_length = clip_header->length - 1;
|
clip_length = clip_header->length - 1;
|
||||||
|
|
||||||
if( clip_text != NULL && is_type_set == FALSE )
|
if( clip_text != NULL && is_type_set == FALSE )
|
||||||
type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR;
|
type = MAUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (clip_text != NULL) && (clip_length > 0) )
|
if( (clip_text != NULL) && (clip_length > 0) )
|
||||||
|
5
src/ui.c
5
src/ui.c
@@ -1609,7 +1609,7 @@ add_to_input_buf_csi(char_u *str, int len)
|
|||||||
|
|
||||||
#if defined(FEAT_HANGULIN) || defined(PROTO)
|
#if defined(FEAT_HANGULIN) || defined(PROTO)
|
||||||
void
|
void
|
||||||
push_raw_key (s, len)
|
push_raw_key(s, len)
|
||||||
char_u *s;
|
char_u *s;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
@@ -2016,7 +2016,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
|||||||
long_u *length;
|
long_u *length;
|
||||||
int *format;
|
int *format;
|
||||||
{
|
{
|
||||||
int motion_type;
|
int motion_type = MAUTO;
|
||||||
long_u len;
|
long_u len;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char **text_list = NULL;
|
char **text_list = NULL;
|
||||||
@@ -2036,7 +2036,6 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
|||||||
*(int *)success = FALSE;
|
*(int *)success = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
motion_type = MCHAR;
|
|
||||||
p = (char_u *)value;
|
p = (char_u *)value;
|
||||||
len = *length;
|
len = *length;
|
||||||
if (*type == vim_atom)
|
if (*type == vim_atom)
|
||||||
|
@@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
221,
|
||||||
/**/
|
/**/
|
||||||
220,
|
220,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user