Hi Bram,
2017/1/25 Wed 1:51:28 UTC+9 Bram Moolenaar wrote:
> Patch 8.0.0230 (after 8.0.0210)
> Problem: When using bracketed paste line breaks are not respected.
> Solution: Turn CR characters into a line break if the text is being
> inserted. (closes #1404)
> Files: src/edit.c
This patch (and also 8.0.0232) still has problem when 'autoindent',
'smartindent' and/or 'cindent' is on.
Line breaks cause indentation, but bracketed paste should paste as if 'paste'
is on.
I think one of the following fixes it:
--- a/src/edit.c
+++ b/src/edit.c
@@ -9463,12 +9463,16 @@ bracketed_paste(paste_mode_T mode, int d
char_u *end = find_termcode((char_u *)"PE");
int ret_char = -1;
int save_allow_keys = allow_keys;
+ int save_paste = p_paste;
+ int save_ai = curbuf->b_p_ai;
/* If the end code is too long we can't detect it, read everything. */
if (STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
allow_keys = 0;
+ p_paste = 1;
+ curbuf->b_p_ai = 0;
for (;;)
{
/* When the end is not defined read everything. */
@@ -9535,6 +9539,8 @@ bracketed_paste(paste_mode_T mode, int d
idx = 0;
}
--no_mapping;
+ curbuf->b_p_ai = save_ai;
+ p_paste = save_paste;
allow_keys = save_allow_keys;
return ret_char;
Or:
--- a/src/edit.c
+++ b/src/edit.c
@@ -9463,12 +9463,14 @@ bracketed_paste(paste_mode_T mode, int d
char_u *end = find_termcode((char_u *)"PE");
int ret_char = -1;
int save_allow_keys = allow_keys;
+ int save_paste = p_paste;
/* If the end code is too long we can't detect it, read everything. */
if (STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
allow_keys = 0;
+ set_option_value((char_u *)"paste", 1L, NULL, 0);
for (;;)
{
/* When the end is not defined read everything. */
@@ -9535,6 +9537,7 @@ bracketed_paste(paste_mode_T mode, int d
idx = 0;
}
--no_mapping;
+ set_option_value((char_u *)"paste", save_paste, NULL, 0);
allow_keys = save_allow_keys;
return ret_char;
I'm not sure the first one is enough, but set_option_value() might does too
much?
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.