lib/text: `Text::format` uses an index starting at 0, as `Array` does
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 15 Feb 2016 20:11:33 +0000 (15:11 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 15 Feb 2016 20:20:02 +0000 (15:20 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/text/abstract_text.nit
src/frontend/i18n_phase.nit

index 58a1c20..4cf56ba 100644 (file)
@@ -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)
index 0550caf..45e07e2 100644 (file)
@@ -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