From: Alexis Laferrière Date: Mon, 15 Feb 2016 20:11:33 +0000 (-0500) Subject: lib/text: `Text::format` uses an index starting at 0, as `Array` does X-Git-Url: http://nitlanguage.org?ds=sidebyside lib/text: `Text::format` uses an index starting at 0, as `Array` does Signed-off-by: Alexis Laferrière --- diff --git a/lib/core/text/abstract_text.nit b/lib/core/text/abstract_text.nit index 58a1c20..4cf56ba 100644 --- a/lib/core/text/abstract_text.nit +++ b/lib/core/text/abstract_text.nit @@ -988,7 +988,7 @@ abstract class Text var fmt_end = i var ciph_len = fmt_end - ciph_st + 1 - var arg_index = substring(ciph_st, ciph_len).to_i - 1 + var arg_index = substring(ciph_st, ciph_len).to_i if arg_index >= args.length then continue s.push substring(curr_st, fmt_st - curr_st) diff --git a/src/frontend/i18n_phase.nit b/src/frontend/i18n_phase.nit index 0550caf..45e07e2 100644 --- a/src/frontend/i18n_phase.nit +++ b/src/frontend/i18n_phase.nit @@ -150,7 +150,7 @@ redef class ASuperstringExpr else fmt += "%" exprs.push i - fmt += exprs.length.to_s + fmt += (exprs.length-1).to_s end end fmt = fmt.escape_to_gettext