#title=""
#tooltip="Sum",1033,"合計",1041,"Součet",1029,"Summe",1031,"Somme",1036,"Suma",3082,"Suma",2058,"Somma",1040,"합계",1042,"Som",1043,"Сумма",1049,"合计",2052,"加總",1028
#icon="sum.ico"
// Do not edit this file.  If you want to edit the file, please copy it into another folder.
// This file will be replaced with a newer version every time EmEditor is upgraded.
if( !document.selection.IsEmpty || document.CellMode ) {
	var a = document.selection.Text.split("\n");
	var sum = 0;
	if( a.length > 1 ) {  // must be multiple lines
		for( var i = 0; i < a.length; i++ ){
			sum += Number(a[i]);
		}
		bOrgCombine = CombineHistory;
		CombineHistory = true;
		if( document.GetColumns() != 0 ) {  // if CSV Mode, use a message box
			alert( sum );
		}
		else if( (document.selection.Mode & eeModeMask) == eeModeBox ) {   // Vertical selection
			y = document.selection.GetBottomPointY( eePosLogical );
			document.selection.Collapse();
			document.selection.SetActivePoint( eePosLogical, 1, y + 1 );
			document.selection.NewLine();
			document.selection.Text = sum;
		}
		else {  // others
			document.selection.CharRight();
			document.selection.NewLine();
			document.selection.Text = sum;
		}
		CombineHistory = bOrgCombine;
	}
}
