]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Amend 3093789e for cmake build
[lyx.git] / src / lyxfind.cpp
index 4c004d54746371aa08e5524720d2683baca3e38e..fc7b0b737a71522a0e006d0e7074afe62213e18f 100644 (file)
@@ -1101,20 +1101,20 @@ public:
   int depts[MAXOPENED];
   int closes[MAXOPENED];
   int actualdeptindex;
-  int previousNotIgnored(int);
-  int nextNotIgnored(int);
+  int previousNotIgnored(int) const;
+  int nextNotIgnored(int) const;
   void handleOpenP(int i);
   void handleCloseP(int i, bool closingAllowed);
   void resetOpenedP(int openPos);
   void addIntervall(int upper);
   void addIntervall(int low, int upper); /* if explicit */
   void removeAccents();
-  void setForDefaultLang(KeyInfo const & defLang);
+  void setForDefaultLang(KeyInfo const & defLang) const;
   int findclosing(int start, int end, char up, char down, int repeat);
   void handleParentheses(int lastpos, bool closingAllowed);
   bool hasTitle;
   int langcount;       // Number of disabled language specs up to current position in actual interval
-  int isOpeningPar(int pos);
+  int isOpeningPar(int pos) const;
   string titleValue;
   void output(ostringstream &os, int lastpos);
   // string show(int lastpos);
@@ -1122,7 +1122,7 @@ public:
 
 vector<Border> Intervall::borders = vector<Border>(30);
 
-int Intervall::isOpeningPar(int pos)
+int Intervall::isOpeningPar(int pos) const
 {
   if ((pos < 0) || (size_t(pos) >= par.size()))
     return 0;
@@ -1137,7 +1137,7 @@ int Intervall::isOpeningPar(int pos)
   return 1;
 }
 
-void Intervall::setForDefaultLang(KeyInfo const & defLang)
+void Intervall::setForDefaultLang(KeyInfo const & defLang) const
 {
   // Enable the use of first token again
   if (ignoreidx >= 0) {
@@ -1295,6 +1295,7 @@ static void buildAccentsMap()
   accents["imath"] = "ı";
   accents["i"] = "ı";
   accents["jmath"] = "ȷ";
+  accents["cdot"] = "·";
   accents["lyxmathsym{ß}"] = "ß";
   accents["text{ß}"] = "ß";
   accents["ddot{\\imath}"] = "ï";
@@ -1360,7 +1361,7 @@ void Intervall::removeAccents()
 {
   if (accents.empty())
     buildAccentsMap();
-  static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap|slashed)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
+  static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap|slashed)\\{[^\\{\\}]+\\}|(i|imath|jmath|cdot)(?![a-zA-Z]))");
   smatch sub;
   for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
     sub = *itacc;
@@ -1371,7 +1372,11 @@ void Intervall::removeAccents()
       for (size_t i = 0; i < val.size(); i++) {
         par[pos+i] = val[i];
       }
-      addIntervall(pos+val.size(), pos + sub.str(0).size());
+      // Remove possibly following space too
+      if (par[pos+sub.str(0).size()] == ' ')
+       addIntervall(pos+val.size(), pos + sub.str(0).size()+1);
+      else
+       addIntervall(pos+val.size(), pos + sub.str(0).size());
       for (size_t i = pos+val.size(); i < pos + sub.str(0).size(); i++) {
         // remove traces of any remaining chars
         par[i] = ' ';
@@ -1413,7 +1418,7 @@ void Intervall::resetOpenedP(int openPos)
   closes[1] = -1;
 }
 
-int Intervall::previousNotIgnored(int start)
+int Intervall::previousNotIgnored(int start) const
 {
     int idx = 0;                          /* int intervalls */
     for (idx = ignoreidx; idx >= 0; --idx) {
@@ -1425,7 +1430,7 @@ int Intervall::previousNotIgnored(int start)
     return start;
 }
 
-int Intervall::nextNotIgnored(int start)
+int Intervall::nextNotIgnored(int start) const
 {
     int idx = 0;                          /* int intervalls */
     for (idx = 0; idx <= ignoreidx; idx++) {
@@ -1499,7 +1504,7 @@ class LatexInfo {
     else
       return false;
   };
-  int find(int start, KeyInfo::KeyType keytype) {
+  int find(int start, KeyInfo::KeyType keytype) const {
     if (start < 0)
       return -1;
     int tmpIdx = start;
@@ -1521,7 +1526,7 @@ class LatexInfo {
     else
       return entries_[keyinfo];
   };
-  void setForDefaultLang(KeyInfo &defLang) {interval_.setForDefaultLang(defLang);};
+  void setForDefaultLang(KeyInfo const & defLang) {interval_.setForDefaultLang(defLang);};
   void addIntervall(int low, int up) { interval_.addIntervall(low, up); };
 };
 
@@ -1572,14 +1577,14 @@ class MathInfo {
     m.mathSize = end - start;
     entries_.push_back(m);
   }
-  bool empty() { return entries_.empty(); };
-  size_t getEndPos() {
+  bool empty() const { return entries_.empty(); };
+  size_t getEndPos() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return 0;
     }
     return entries_[actualIdx_].mathEnd;
   }
-  size_t getStartPos() {
+  size_t getStartPos() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return 100000;                    /*  definitely enough? */
     }
@@ -1589,7 +1594,7 @@ class MathInfo {
     actualIdx_ = 0;
     return getStartPos();
   }
-  size_t getSize() {
+  size_t getSize() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return size_t(0);
     }