Commit 71169c17 authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug #34402 Added a cursor position correction after adding a equation.

parent 7952793a
...@@ -187,7 +187,7 @@ function CMathBase(bInside) ...@@ -187,7 +187,7 @@ function CMathBase(bInside)
return this; return this;
} }
CMathBase.prototype = Object.create(CParagraphContentWithParagraphLikeContent.prototype); CMathBase.prototype = Object.create(CParagraphContentWithParagraphLikeContent.prototype);
CMathBase.prototype.constructor = CMathBase; CMathBase.prototype.constructor = CMathBase;
CMathBase.prototype.setContent = function() CMathBase.prototype.setContent = function()
{ {
...@@ -1560,6 +1560,12 @@ CMathBase.prototype.Correct_Content = function(bInnerCorrection) ...@@ -1560,6 +1560,12 @@ CMathBase.prototype.Correct_Content = function(bInnerCorrection)
{ {
this.Content[nIndex].Correct_Content(bInnerCorrection); this.Content[nIndex].Correct_Content(bInnerCorrection);
} }
if (this.CurPos >= this.Content.length)
this.CurPos = this.Content.length - 1;
if (this.CurPos < 0)
this.CurPos = 0;
}; };
CMathBase.prototype.Undo = function(Data) CMathBase.prototype.Undo = function(Data)
{ {
......
...@@ -1237,7 +1237,7 @@ function CMathContent() ...@@ -1237,7 +1237,7 @@ function CMathContent()
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора) // Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
AscCommon.g_oTableId.Add( this, this.Id ); AscCommon.g_oTableId.Add( this, this.Id );
} }
CMathContent.prototype = Object.create(CParagraphContentWithParagraphLikeContent.prototype); CMathContent.prototype = Object.create(CParagraphContentWithParagraphLikeContent.prototype);
CMathContent.prototype.constructor = CMathContent; CMathContent.prototype.constructor = CMathContent;
CMathContent.prototype.init = function() CMathContent.prototype.init = function()
{ {
...@@ -1765,6 +1765,11 @@ CMathContent.prototype.Correct_Content = function(bInnerCorrection) ...@@ -1765,6 +1765,11 @@ CMathContent.prototype.Correct_Content = function(bInnerCorrection)
if (isEmptyContent) if (isEmptyContent)
this.SetPlaceholder(); this.SetPlaceholder();
} }
if (this.CurPos >= this.Content.length)
this.CurPos = this.Content.length - 1;
if (this.CurPos < 0)
this.CurPos = 0;
}; };
CMathContent.prototype.Correct_ContentPos = function(nDirection) CMathContent.prototype.Correct_ContentPos = function(nDirection)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment