Index: ProjectEditor/TextEditor_KeyEvent.cpp
===================================================================
--- ProjectEditor/TextEditor_KeyEvent.cpp	(revision 22)
+++ ProjectEditor/TextEditor_KeyEvent.cpp	(revision 24)
@@ -12,8 +12,8 @@
 		WndNum=GetWndNum(GetParent(hwnd));
 
-		if(MdiInfo[WndNum].pmti->iUnderStart!=-1){
+		if(MdiInfo[WndNum].pMdiTextEdit->iUnderStart!=-1){
 			//ハイパーリンク下線の表示を解除
-			MdiInfo[WndNum].pmti->iUnderStart=-1;
-			MdiInfo[WndNum].pmti->iUnderEnd=-1;
+			MdiInfo[WndNum].pMdiTextEdit->iUnderStart=-1;
+			MdiInfo[WndNum].pMdiTextEdit->iUnderEnd=-1;
 
 			//再描画
@@ -147,5 +147,5 @@
 	char *pBuf;
 
-	pBuf=MdiInfo[WndNum].pmti->buffer;
+	pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 	for(i=iPos;i>0;i--){
 		if(pBuf[i-1]=='\r'&&pBuf[i]=='\n') return i+1;
@@ -235,5 +235,5 @@
 			}
 
-			pBuf=MdiInfo[WndNum].pmti->buffer;
+			pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 			int StartX;
@@ -241,11 +241,11 @@
 			//リプレイス前のカーソルバッファ位置を取得
 			i=GetBufferIndexFromCaretPos(pBuf,
-				MdiInfo[WndNum].pmti->StartCaretPos.x,
-				MdiInfo[WndNum].pmti->StartCaretPos.y);
-			StartX=MdiInfo[WndNum].pmti->StartCaretPos.x;
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
+			StartX=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x;
 
 			//リプレイス
 			TextEdit_ReplaceUpdateUndoData(WndNum,temporary,0,1);
-			pBuf=MdiInfo[WndNum].pmti->buffer;
+			pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 			//リプレイス後のカーソル行のインデントをi3に取得
@@ -290,6 +290,6 @@
 			*/
 			i=GetBufferIndexFromCaretPos(pBuf,
-				MdiInfo[WndNum].pmti->StartCaretPos.x,
-				MdiInfo[WndNum].pmti->StartCaretPos.y);
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
 			if(pBuf[i]=='\r'&&
 				pBuf[i+1]=='\n'){
@@ -322,5 +322,5 @@
 	}
 	else if(nVirtualKey==VK_TAB){
-		pBuf=MdiInfo[WndNum].pmti->buffer;
+		pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 		TextEdit_GetSel(WndNum,&CharRange);
@@ -409,5 +409,5 @@
 			//リプレイス
 			TextEdit_ReplaceUpdateUndoData(WndNum,pTemp,0,0);
-			pBuf=MdiInfo[WndNum].pmti->buffer;
+			pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 			HeapDefaultFree(pTemp);
@@ -496,8 +496,8 @@
 			case VK_LEFT:
 				//上下キャレット移動時の左右位置保持機能を解除
-				MdiInfo[WndNum].pmti->Temp_UpDown_CaretXPos=-1;
-
-				if((MdiInfo[WndNum].pmti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&
-					MdiInfo[WndNum].pmti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y)||
+				MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=-1;
+
+				if((MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&&
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)||
 					GetKeyState(VK_SHIFT)&0x8000){
 					//選択中でないとき、またはシフトキーが押されているとき
@@ -506,13 +506,13 @@
 				else{
 					//選択中のとき
-					if(MdiInfo[WndNum].pmti->StartCaretPos.y<MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
-					else if(MdiInfo[WndNum].pmti->StartCaretPos.y>MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+					if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
+					else if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y>MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 					else{
-						if(MdiInfo[WndNum].pmti->StartCaretPos.x<MdiInfo[WndNum].pmti->EndCaretPos.x)
-							MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+						if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x)
+							MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 						else
-							MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+							MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 					}
 				}
@@ -520,24 +520,24 @@
 			case VK_RIGHT:
 				//上下キャレット移動時の左右位置保持機能を解除
-				MdiInfo[WndNum].pmti->Temp_UpDown_CaretXPos=-1;
-
-				if((MdiInfo[WndNum].pmti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&
-					MdiInfo[WndNum].pmti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y)||
+				MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=-1;
+
+				if((MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&&
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)||
 					GetKeyState(VK_SHIFT)&0x8000){
 					//選択中でないとき、またはシフトキーが押されているとき
 					GetNaturalCaretPos_Right(WndNum,
-						&MdiInfo[WndNum].pmti->StartCaretPos);
+						&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				}
 				else{
 					//選択中のとき
-					if(MdiInfo[WndNum].pmti->StartCaretPos.y<MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
-					else if(MdiInfo[WndNum].pmti->StartCaretPos.y>MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+					if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
+					else if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y>MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 					else{
-						if(MdiInfo[WndNum].pmti->StartCaretPos.x<MdiInfo[WndNum].pmti->EndCaretPos.x)
-							MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+						if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x)
+							MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 						else
-							MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+							MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 					}
 				}
@@ -545,67 +545,67 @@
 			case VK_UP:
 				if((GetKeyState(VK_CONTROL)&0x8000)&&
-					MdiInfo[WndNum].pmti->StartCaretPos.x!=0){
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x!=0){
 					//行の先頭へキャレットを移動
-					MdiInfo[WndNum].pmti->StartCaretPos.x=0;
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0;
 
 					//上下キャレット移動時の左右位置保持機能を解除
-					MdiInfo[WndNum].pmti->Temp_UpDown_CaretXPos=-1;
+					MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=-1;
 				}
 				else{
-					if((MdiInfo[WndNum].pmti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&
-						MdiInfo[WndNum].pmti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y)||
+					if((MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&&
+						MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)||
 						GetKeyState(VK_SHIFT)&0x8000){
 						//選択中でないとき、またはシフトキーが押されているとき
 						GetNaturalCaretPos_Up(WndNum,
-							&MdiInfo[WndNum].pmti->StartCaretPos);
+							&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 					}
 					else{
 						//選択中のとき
-						if(MdiInfo[WndNum].pmti->StartCaretPos.y<MdiInfo[WndNum].pmti->EndCaretPos.y)
-							MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
-						else if(MdiInfo[WndNum].pmti->StartCaretPos.y>MdiInfo[WndNum].pmti->EndCaretPos.y)
-							MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+						if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+							MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
+						else if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y>MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+							MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 						else{
-							if(MdiInfo[WndNum].pmti->StartCaretPos.x<MdiInfo[WndNum].pmti->EndCaretPos.x)
-								MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+							if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x)
+								MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 							else
-								MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+								MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 						}
 
 						GetNaturalCaretPos_Up(WndNum,
-							&MdiInfo[WndNum].pmti->StartCaretPos);
+							&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 					}
 				}
 				break;
 			case VK_DOWN:
-				i2=MdiInfo[WndNum].pmti->StartCaretPos.y;
-				if((MdiInfo[WndNum].pmti->StartCaretPos.x==MdiInfo[WndNum].pmti->EndCaretPos.x&&
-					MdiInfo[WndNum].pmti->StartCaretPos.y==MdiInfo[WndNum].pmti->EndCaretPos.y)||
+				i2=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y;
+				if((MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x&&
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y==MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)||
 					GetKeyState(VK_SHIFT)&0x8000){
 					//選択中でないとき、またはシフトキーが押されているとき
 					GetNaturalCaretPos_Down(WndNum,
-						&MdiInfo[WndNum].pmti->StartCaretPos);
+						&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				}
 				else{
 					//選択中のとき
-					if(MdiInfo[WndNum].pmti->StartCaretPos.y<MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
-					else if(MdiInfo[WndNum].pmti->StartCaretPos.y>MdiInfo[WndNum].pmti->EndCaretPos.y)
-						MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+					if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
+					else if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y>MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.y)
+						MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 					else{
-						if(MdiInfo[WndNum].pmti->StartCaretPos.x<MdiInfo[WndNum].pmti->EndCaretPos.x)
-							MdiInfo[WndNum].pmti->StartCaretPos=MdiInfo[WndNum].pmti->EndCaretPos;
+						if(MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x<MdiInfo[WndNum].pMdiTextEdit->EndCaretPos.x)
+							MdiInfo[WndNum].pMdiTextEdit->StartCaretPos=MdiInfo[WndNum].pMdiTextEdit->EndCaretPos;
 						else
-							MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+							MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 					}
 
 					GetNaturalCaretPos_Down(WndNum,
-						&MdiInfo[WndNum].pmti->StartCaretPos);
+						&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				}
 
 				if(GetKeyState(VK_CONTROL)&0x8000){
-					if(i2!=MdiInfo[WndNum].pmti->StartCaretPos.y){
+					if(i2!=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y){
 						//行の先頭へキャレットを移動
-						MdiInfo[WndNum].pmti->StartCaretPos.x=0;
+						MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0;
 					}
 					else{
@@ -613,19 +613,19 @@
 						CaretPos_LooseToNatural(WndNum,
 							INT_MAX,
-							MdiInfo[WndNum].pmti->StartCaretPos.y,
-							&MdiInfo[WndNum].pmti->StartCaretPos);
+							MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y,
+							&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 					}
 
 					//上下キャレット移動時の左右位置保持機能を解除
-					MdiInfo[WndNum].pmti->Temp_UpDown_CaretXPos=-1;
+					MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=-1;
 				}
 				break;
 			case VK_PRIOR:
 				GetNaturalCaretPos_PageUp(WndNum,
-					&MdiInfo[WndNum].pmti->StartCaretPos);
+					&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				break;
 			case VK_NEXT:
 				GetNaturalCaretPos_PageDown(WndNum,
-					&MdiInfo[WndNum].pmti->StartCaretPos);
+					&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				break;
 		}
@@ -633,5 +633,5 @@
 		if(!(GetKeyState(VK_SHIFT)&0x8000)){
 			//シフトキーが押されていない、通常時
-			MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+			MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 		}
 
@@ -660,11 +660,11 @@
 
 		//上下キャレット移動時の左右位置保持機能を解除
-		MdiInfo[WndNum].pmti->Temp_UpDown_CaretXPos=-1;
+		MdiInfo[WndNum].pMdiTextEdit->Temp_UpDown_CaretXPos=-1;
 
 		if(GetKeyState(VK_CONTROL)&0x8000){
 			//ファイルの先頭または末端へキャレットを移動
 			if(nVirtualKey==VK_HOME){
-				MdiInfo[WndNum].pmti->StartCaretPos.x=0;
-				MdiInfo[WndNum].pmti->StartCaretPos.y=0;
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0;
+				MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y=0;
 			}
 			else if(nVirtualKey==VK_END){
@@ -673,16 +673,16 @@
 					INT_MAX,
 					INT_MAX,
-					&MdiInfo[WndNum].pmti->StartCaretPos);
+					&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 			}
 		}
 		else{
 			//行の先頭または末端へキャレットを移動
-			if(nVirtualKey==VK_HOME) MdiInfo[WndNum].pmti->StartCaretPos.x=0;
+			if(nVirtualKey==VK_HOME) MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0;
 			else if(nVirtualKey==VK_END){
 				//存在するキャレット位置に変換
 				CaretPos_LooseToNatural(WndNum,
 					INT_MAX,
-					MdiInfo[WndNum].pmti->StartCaretPos.y,
-					&MdiInfo[WndNum].pmti->StartCaretPos);
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y,
+					&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 			}
 		}
@@ -690,5 +690,5 @@
 		if(!(GetKeyState(VK_SHIFT)&0x8000)){
 			//シフトキーが押されていない、通常時
-			MdiInfo[WndNum].pmti->EndCaretPos=MdiInfo[WndNum].pmti->StartCaretPos;
+			MdiInfo[WndNum].pMdiTextEdit->EndCaretPos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
 		}
 
@@ -709,5 +709,5 @@
 		TextEdit_GetSel(WndNum,&CharRange);
 
-		pBuf=MdiInfo[WndNum].pmti->buffer;
+		pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 		//キャレットがファイルの終端にあるとき
@@ -731,7 +731,7 @@
 
 			GetCaretPosFromBufferIndex(
-				MdiInfo[WndNum].pmti->buffer,
+				MdiInfo[WndNum].pMdiTextEdit->buffer,
 				CharRange.cpMax,
-				&MdiInfo[WndNum].pmti->EndCaretPos);
+				&MdiInfo[WndNum].pMdiTextEdit->EndCaretPos);
 		}
 
@@ -753,11 +753,11 @@
 
 				i=GetBufferIndexFromCaretPos(
-					MdiInfo[WndNum].pmti->buffer,
-					MdiInfo[WndNum].pmti->StartCaretPos.x,
-					MdiInfo[WndNum].pmti->StartCaretPos.y);
+					MdiInfo[WndNum].pMdiTextEdit->buffer,
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
+					MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
 				GetCaretPosFromBufferIndex(
-					MdiInfo[WndNum].pmti->buffer,
+					MdiInfo[WndNum].pMdiTextEdit->buffer,
 					i-1,
-					&MdiInfo[WndNum].pmti->StartCaretPos);
+					&MdiInfo[WndNum].pMdiTextEdit->StartCaretPos);
 				TextEdit_Replace(WndNum,"",1);
 			}
@@ -789,5 +789,5 @@
 
 	char *pBuf;
-	pBuf=MdiInfo[WndNum].pmti->buffer;
+	pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 
@@ -823,6 +823,6 @@
 
 		i=GetBufferIndexFromCaretPos(pBuf,
-			MdiInfo[WndNum].pmti->StartCaretPos.x,
-			MdiInfo[WndNum].pmti->StartCaretPos.y);
+			MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
+			MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
 
 		i2=i-2;
@@ -961,5 +961,5 @@
 
 	char *pBuf;
-	pBuf=MdiInfo[WndNum].pmti->buffer;
+	pBuf=MdiInfo[WndNum].pMdiTextEdit->buffer;
 
 
@@ -972,6 +972,6 @@
  
 		i=GetBufferIndexFromCaretPos(pBuf,
-			MdiInfo[WndNum].pmti->StartCaretPos.x,
-			MdiInfo[WndNum].pmti->StartCaretPos.y);
+			MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x,
+			MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y);
 
 		if(GetNowTagInfo(pBuf,i-1)){
