mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
fix 'double =' glitch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2972 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f73a9f37f4
commit
2f858329df
@ -51,19 +51,6 @@ using std::vector;
|
||||
|
||||
namespace {
|
||||
|
||||
void stripFromLastEqualSign(MathArray & ar)
|
||||
{
|
||||
// find position of last '=' in the array
|
||||
MathArray::size_type pos = ar.size();
|
||||
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
||||
if ((*it)->getChar() == '=')
|
||||
pos = it - ar.begin();
|
||||
|
||||
// delete everything behind this position
|
||||
ar.erase(pos, ar.size());
|
||||
}
|
||||
|
||||
|
||||
string captureOutput(string const & cmd, string const & data)
|
||||
{
|
||||
string outfile = lyx::tempName(string(), "mathextern");
|
||||
@ -438,9 +425,8 @@ void InsetFormula::handleExtern(const string & arg)
|
||||
mathcursor->selGet(ar);
|
||||
lyxerr << "use selection: " << ar << "\n";
|
||||
} else {
|
||||
mathcursor->end();
|
||||
mathcursor->stripFromLastEqualSign();
|
||||
ar = mathcursor->cursor().cell();
|
||||
stripFromLastEqualSign(ar);
|
||||
mathcursor->insert(MathAtom(new MathCharInset('=', LM_TC_VAR)));
|
||||
//lyxerr << "use whole cell: " << ar << "\n";
|
||||
}
|
||||
|
@ -1499,3 +1499,18 @@ MathCursorPos MathCursor::normalAnchor() const
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::stripFromLastEqualSign()
|
||||
{
|
||||
// find position of last '=' in the array
|
||||
MathArray & ar = cursor().cell();
|
||||
MathArray::const_iterator et = ar.end();
|
||||
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
||||
if ((*it)->getChar() == '=')
|
||||
et = it;
|
||||
|
||||
// delete everything behind this position
|
||||
ar.erase(et - ar.begin(), ar.size());
|
||||
pos() = ar.size();
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,6 +247,8 @@ public:
|
||||
void seldump(char const * str) const;
|
||||
///
|
||||
void dump(char const * str) const;
|
||||
///
|
||||
void stripFromLastEqualSign();
|
||||
|
||||
///
|
||||
friend class Selection;
|
||||
|
@ -52,11 +52,17 @@ void MathFuncInset::writeNormal(std::ostream & os) const
|
||||
void MathFuncInset::metrics(MathMetricsInfo const & mi) const
|
||||
{
|
||||
mi_ = mi;
|
||||
mathed_string_dim(LM_TC_TEX, mi_, name_, ascent_, descent_, width_);
|
||||
mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_);
|
||||
}
|
||||
|
||||
|
||||
void MathFuncInset::draw(Painter & pain, int x, int y) const
|
||||
{
|
||||
drawStr(pain, LM_TC_TEX, mi_, x, y, name_);
|
||||
drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_);
|
||||
}
|
||||
|
||||
|
||||
string MathFuncInset::octavize() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "math_diminset.h"
|
||||
#include "math_defs.h"
|
||||
#include "LString.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
@ -31,6 +30,8 @@ public:
|
||||
string const & name() const;
|
||||
///
|
||||
void setName(string const & n);
|
||||
///
|
||||
string octavize() const;
|
||||
private:
|
||||
///
|
||||
string name_;
|
||||
|
Loading…
Reference in New Issue
Block a user