0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1689

Problem:    Ruby interface has inconsistent coding style.
Solution:   Fix the coding style. (Ken Takata)
This commit is contained in:
Bram Moolenaar 2016-03-30 22:06:16 +02:00
parent 67c2c058ea
commit 758535a1df
2 changed files with 26 additions and 12 deletions

View File

@ -731,7 +731,8 @@ vim_str2rb_enc_str(const char *s)
{ {
enc = rb_enc_find((char *)sval); enc = rb_enc_find((char *)sval);
vim_free(sval); vim_free(sval);
if (enc) { if (enc)
{
return rb_enc_str_new(s, strlen(s), enc); return rb_enc_str_new(s, strlen(s), enc);
} }
} }
@ -773,19 +774,23 @@ void ex_rubydo(exarg_T *eap)
{ {
if (u_save(eap->line1 - 1, eap->line2 + 1) != OK) if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
return; return;
for (i = eap->line1; i <= eap->line2; i++) { for (i = eap->line1; i <= eap->line2; i++)
{
VALUE line; VALUE line;
line = vim_str2rb_enc_str((char *)ml_get(i)); line = vim_str2rb_enc_str((char *)ml_get(i));
rb_lastline_set(line); rb_lastline_set(line);
eval_enc_string_protect((char *) eap->arg, &state); eval_enc_string_protect((char *) eap->arg, &state);
if (state) { if (state)
{
error_print(state); error_print(state);
break; break;
} }
line = rb_lastline_get(); line = rb_lastline_get();
if (!NIL_P(line)) { if (!NIL_P(line))
if (TYPE(line) != T_STRING) { {
if (TYPE(line) != T_STRING)
{
EMSG(_("E265: $_ must be an instance of String")); EMSG(_("E265: $_ must be an instance of String"));
return; return;
} }
@ -898,7 +903,8 @@ static void error_print(int state)
#define TAG_FATAL 0x8 #define TAG_FATAL 0x8
#define TAG_MASK 0xf #define TAG_MASK 0xf
switch (state) { switch (state)
{
case TAG_RETURN: case TAG_RETURN:
EMSG(_("E267: unexpected return")); EMSG(_("E267: unexpected return"));
break; break;
@ -923,10 +929,12 @@ static void error_print(int state)
eclass = CLASS_OF(ruby_errinfo); eclass = CLASS_OF(ruby_errinfo);
einfo = rb_obj_as_string(ruby_errinfo); einfo = rb_obj_as_string(ruby_errinfo);
#endif #endif
if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0)
{
EMSG(_("E272: unhandled exception")); EMSG(_("E272: unhandled exception"));
} }
else { else
{
VALUE epath; VALUE epath;
char *p; char *p;
@ -1208,7 +1216,8 @@ static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
/* set curwin/curbuf for "buf" and save some things */ /* set curwin/curbuf for "buf" and save some things */
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
if (u_savesub(n) == OK) { if (u_savesub(n) == OK)
{
ml_replace(n, (char_u *)line, TRUE); ml_replace(n, (char_u *)line, TRUE);
changed(); changed();
#ifdef SYNTAX_HL #ifdef SYNTAX_HL
@ -1249,7 +1258,8 @@ static VALUE buffer_delete(VALUE self, VALUE num)
/* set curwin/curbuf for "buf" and save some things */ /* set curwin/curbuf for "buf" and save some things */
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
if (u_savedel(n, 1) == OK) { if (u_savedel(n, 1) == OK)
{
ml_delete(n, 0); ml_delete(n, 0);
/* Changes to non-active buffers should properly refresh /* Changes to non-active buffers should properly refresh
@ -1288,7 +1298,8 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
/* set curwin/curbuf for "buf" and save some things */ /* set curwin/curbuf for "buf" and save some things */
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
if (u_inssub(n + 1) == OK) { if (u_inssub(n + 1) == OK)
{
ml_append(n, (char_u *) line, (colnr_T) 0, FALSE); ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
/* Changes to non-active buffers should properly refresh screen /* Changes to non-active buffers should properly refresh screen
@ -1494,7 +1505,8 @@ static VALUE f_p(int argc, VALUE *argv, VALUE self UNUSED)
int i; int i;
VALUE str = rb_str_new("", 0); VALUE str = rb_str_new("", 0);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++)
{
if (i > 0) rb_str_cat(str, ", ", 2); if (i > 0) rb_str_cat(str, ", ", 2);
rb_str_concat(str, rb_inspect(argv[i])); rb_str_concat(str, rb_inspect(argv[i]));
} }

View File

@ -748,6 +748,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 */
/**/
1689,
/**/ /**/
1688, 1688,
/**/ /**/