changeset 13:a05bf0823154

Fixes SubStr (RLdev's strsub/strrsub)
author thib
date Wed, 06 Aug 2008 12:34:34 +0000
parents 2e6a92ed913b
children 8da1d92ac8f8
files scn2k/scn2k_cmd.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scn2k/scn2k_cmd.cc
+++ b/scn2k/scn2k_cmd.cc
@@ -423,6 +423,7 @@ bool Flags::Exec(Cmd& cmd) {
 		case 5: // substring, index from left
 		case 6: // substring, index from right
 			// 全角対応らしい
+			//FIXME: Make sure it works properly
 			{ int offset = cmd.args[2].value;
 			int len = strlen(cmd.Str(cmd.args[1]));
 			string str = cmd.Str(cmd.args[1]);
@@ -439,7 +440,7 @@ bool Flags::Exec(Cmd& cmd) {
 			if (s[offset_top] == 0) {
 				SetStr(arg1, "");
 			} else if (cmd.cmd4 == 0) { // 長さ制限なし
-				SetStr(arg1, string(s, offset_top));
+			    SetStr(arg1, string(s, offset_top, len-offset_top));
 			} else { // cmd.cmd4 == 1
 				int slen = cmd.args[3].value;
 				int offset_end = offset_top;