]> git.lyx.org Git - features.git/blobdiff - src/lyxfind.cpp
Amend b5d9bbfe: FindAdv: Added handling of some missing conversions
[features.git] / src / lyxfind.cpp
index 1760c94384ead028602d481fcf791e9e0041b5ff..696a2562f60a2f6063c95a3ee5f4f1f67106e684 100644 (file)
@@ -359,6 +359,12 @@ bool findOne(BufferView * bv, docstring const & searchstr,
                                bv->cursor().setCursor(doc_iterator_end(&bv->buffer()));
                                bv->cursor().backwardPos();
                        }
+                       if (auto_wrap) {
+                               docstring const msg = forward
+                                 ? _("Search reached end of document, continuing from beginning.")
+                                 : _("Search reached beginning of document, continuing from end.");
+                               bv->message(msg);
+                       }
                        bv->clearSelection();
                        if (findOne(bv, searchstr, case_sens, whole, forward,
                                    find_del, false, false, false, false))
@@ -929,7 +935,7 @@ public:
        int pos_len;
        int searched_size;
        vector <string> result = vector <string>();
-       MatchResult(int len = 0): match_len(len),match_prefix(0),match2end(0), pos(0),leadsize(0),pos_len(-1),searched_size(0) {};
+       MatchResult(int len = 0): match_len(len),match_prefix(0),match2end(0), pos(0),leadsize(0),pos_len(-1),searched_size(0) {}
 };
 
 static MatchResult::range interpretMatch(MatchResult &oldres, MatchResult &newres)
@@ -1242,7 +1248,7 @@ class KeyInfo {
 
 class Border {
  public:
- Border(int l=0, int u=0) : low(l), upper(u) {};
+ Border(int l=0, int u=0) : low(l), upper(u) {}
   int low;
   int upper;
 };
@@ -1501,12 +1507,18 @@ static void addAccents(string latex_in, string unicode_out)
 
 void static fillMissingUnicodesymbols()
 {
+  addAccents("\\pounds", getutf8(0x00a3));
+  addAccents("\\textsterling", getutf8(0x00a3));
   addAccents("\\textyen", getutf8(0x00a5));
   addAccents("\\yen", getutf8(0x00a5));
   addAccents("\\textsection", getutf8(0x00a7));
   addAccents("\\mathsection", getutf8(0x00a7));
+  addAccents("\\textcopyright", getutf8(0x00a9));
+  addAccents("\\copyright", getutf8(0x00a9));
   addAccents("\\textlnot", getutf8(0x00ac));
   addAccents("\\neg", getutf8(0x00ac));
+  addAccents("\\textregistered", getutf8(0x00ae));
+  addAccents("\\circledR", getutf8(0x00ae));
   addAccents("\\textpm", getutf8(0x00b1));
   addAccents("\\pm", getutf8(0x00b1));
   addAccents("\\textparagraph", getutf8(0x00b6));
@@ -1514,12 +1526,36 @@ void static fillMissingUnicodesymbols()
   addAccents("\\textperiodcentered", getutf8(0x00b7));
   addAccents("\\texttimes", getutf8(0x00d7));
   addAccents("\\times", getutf8(0x00d7));
+  addAccents("\\O", getutf8(0x00d8));
   addAccents("\\dh", getutf8(0x00f0));
   addAccents("\\eth", getutf8(0x00f0));
   addAccents("\\textdiv", getutf8(0x00f7));
   addAccents("\\div", getutf8(0x00f7));
   addAccents("\\o", getutf8(0x00f8));
+  addAccents("\\textcrlambda", getutf8(0x019b));
   addAccents("\\j", getutf8(0x0237));
+  addAccents("\\textGamma", getutf8(0x0393));
+  addAccents("\\Gamma", getutf8(0x0393));
+  addAccents("\\textDelta", getutf8(0x0394));
+  addAccents("\\Delta", getutf8(0x0394));
+  addAccents("\\textTheta", getutf8(0x0398));
+  addAccents("\\Theta", getutf8(0x0398));
+  addAccents("\\textLambda", getutf8(0x039b));
+  addAccents("\\Lambda", getutf8(0x039b));
+  addAccents("\\textXi", getutf8(0x039e));
+  addAccents("\\Xi", getutf8(0x039e));
+  addAccents("\\textPi", getutf8(0x03a0));
+  addAccents("\\Pi", getutf8(0x03a0));
+  addAccents("\\textSigma", getutf8(0x03a3));
+  addAccents("\\Sigma", getutf8(0x03a3));
+  addAccents("\\textUpsilon", getutf8(0x03a5));
+  addAccents("\\Upsilon", getutf8(0x03a5));
+  addAccents("\\textPhi", getutf8(0x03a6));
+  addAccents("\\Phi", getutf8(0x03a6));
+  addAccents("\\textPsi", getutf8(0x03a8));
+  addAccents("\\Psi", getutf8(0x03a8));
+  addAccents("\\textOmega", getutf8(0x03a9));
+  addAccents("\\Omega", getutf8(0x03a9));
   addAccents("\\textalpha", getutf8(0x03b1));
   addAccents("\\alpha", getutf8(0x03b1));
   addAccents("\\textbeta", getutf8(0x03b2));
@@ -1578,6 +1614,30 @@ void static fillMissingUnicodesymbols()
   addAccents("\\gimel", getutf8(0x05d2));
   addAccents("\\hebdalet", getutf8(0x05d3));
   addAccents("\\daleth", getutf8(0x05d3));
+  addAccents("\\hebhe", getutf8(0x05d4));
+  addAccents("\\hebvav", getutf8(0x05d5));
+  addAccents("\\hebzayin", getutf8(0x05d6));
+  addAccents("\\hebhet", getutf8(0x05d7));
+  addAccents("\\hebtet", getutf8(0x05d8));
+  addAccents("\\hebyod", getutf8(0x05d9));
+  addAccents("\\hebfinalkaf", getutf8(0x05da));
+  addAccents("\\hebkaf", getutf8(0x05db));
+  addAccents("\\heblamed", getutf8(0x05dc));
+  addAccents("\\hebfinalmem", getutf8(0x05dd));
+  addAccents("\\hebmem", getutf8(0x05de));
+  addAccents("\\hebfinalnun", getutf8(0x05df));
+  addAccents("\\hebnun", getutf8(0x05e0));
+  addAccents("\\hebsamekh", getutf8(0x05e1));
+  addAccents("\\hebayin", getutf8(0x05e2));
+  addAccents("\\hebfinalpe", getutf8(0x05e3));
+  addAccents("\\hebpe", getutf8(0x05e4));
+  addAccents("\\hebfinaltsadi", getutf8(0x05e5));
+  addAccents("\\hebtsadi", getutf8(0x05e6));
+  addAccents("\\hebqof", getutf8(0x05e7));
+  addAccents("\\hebresh", getutf8(0x05e8));
+  addAccents("\\hebshin", getutf8(0x05e9));
+  addAccents("\\hebtav", getutf8(0x05ea));
+
   // Thai characters
   addAccents("\\thaiKoKai", getutf8(0x0e01));
   addAccents("\\thaiKhoKhai", getutf8(0x0e02));
@@ -1665,19 +1725,24 @@ void static fillMissingUnicodesymbols()
   addAccents("\\thainine", getutf8(0x0e59));
   addAccents("\\thaiAngkhankhu", getutf8(0x0e5a));
   addAccents("\\thaiKhomut", getutf8(0x0e5b));
-
   addAccents("\\dag", getutf8(0x2020));
   addAccents("\\dagger", getutf8(0x2020));
+  addAccents("\\textdagger", getutf8(0x2020));
   addAccents("\\ddag", getutf8(0x2021));
   addAccents("\\ddagger", getutf8(0x2021));
   addAccents("\\textbullet", getutf8(0x2022));
   addAccents("\\bullet", getutf8(0x2022));
   addAccents("\\dots", getutf8(0x2026));
   addAccents("\\ldots", getutf8(0x2026));
+  addAccents("\\textellipsis", getutf8(0x2026));
   addAccents("\\textasciiacute", getutf8(0x2032));
   addAccents("\\prime", getutf8(0x2032));
+  addAccents("\\textacutedbl", getutf8(0x2033));
+  addAccents("\\dprime", getutf8(0x2033));
   addAccents("\\textasciigrave", getutf8(0x2035));
   addAccents("\\backprime", getutf8(0x2035));
+  addAccents("\\textsubcircum{ }", getutf8(0x2038));
+  addAccents("\\caretinsert", getutf8(0x2038));
   addAccents("\\textasteriskcentered", getutf8(0x204e));
   addAccents("\\ast", getutf8(0x204e));
   addAccents("\\textmho", getutf8(0x2127));
@@ -1698,6 +1763,14 @@ void static fillMissingUnicodesymbols()
   addAccents("\\surd", getutf8(0x221a));
   addAccents("\\textbigcircle", getutf8(0x25ef));
   addAccents("\\bigcirc", getutf8(0x25ef));
+  addAccents("\\FiveStar", getutf8(0x2605));
+  addAccents("\\bigstar", getutf8(0x2605));
+  addAccents("\\FiveStarOpen", getutf8(0x2606));
+  addAccents("\\bigwhitestar", getutf8(0x2606));
+  addAccents("\\Checkmark", getutf8(0x2713));
+  addAccents("\\checkmark", getutf8(0x2713));
+  addAccents("\\CrossMaltese", getutf8(0x2720));
+  addAccents("\\maltese", getutf8(0x2720));
   addAccents("\\textlangle", getutf8(0x27e8));
   addAccents("\\langle", getutf8(0x27e8));
   addAccents("\\textrangle", getutf8(0x27e9));
@@ -1914,7 +1987,7 @@ class LatexInfo {
     buildKeys(isPatternString);
     entries_ = vector<KeyInfo>();
     buildEntries(isPatternString);
-  };
+  }
   int getFirstKey() {
     entidx_ = 0;
     if (entries_.empty()) {
@@ -1935,7 +2008,7 @@ class LatexInfo {
         return -1;
     }
     return 0;
-  };
+  }
   int getNextKey() {
     entidx_++;
     if (int(entries_.size()) > entidx_) {
@@ -1944,7 +2017,7 @@ class LatexInfo {
     else {
       return -1;
     }
-  };
+  }
   bool setNextKey(int idx) {
     if ((idx == entidx_) && (entidx_ >= 0)) {
       entidx_--;
@@ -1952,7 +2025,7 @@ class LatexInfo {
     }
     else
       return false;
-  };
+  }
   int find(int start, KeyInfo::KeyType keytype) const {
     if (start < 0)
       return -1;
@@ -1963,20 +2036,20 @@ class LatexInfo {
       tmpIdx++;
     }
     return -1;
-  };
+  }
   int process(ostringstream & os, KeyInfo const & actual);
   int dispatch(ostringstream & os, int previousStart, KeyInfo & actual);
-  // string show(int lastpos) { return interval.show(lastpos);};
-  int nextNotIgnored(int start) { return interval_.nextNotIgnored(start);};
+  // string show(int lastpos) { return interval.show(lastpos);}
+  int nextNotIgnored(int start) { return interval_.nextNotIgnored(start);}
   KeyInfo &getKeyInfo(int keyinfo) {
     static KeyInfo invalidInfo = KeyInfo();
     if ((keyinfo < 0) || ( keyinfo >= int(entries_.size())))
       return invalidInfo;
     else
       return entries_[keyinfo];
-  };
-  void setForDefaultLang(KeyInfo const & defLang) {interval_.setForDefaultLang(defLang);};
-  void addIntervall(int low, int up) { interval_.addIntervall(low, up); };
+  }
+  void setForDefaultLang(KeyInfo const & defLang) {interval_.setForDefaultLang(defLang);}
+  void addIntervall(int low, int up) { interval_.addIntervall(low, up); }
 };
 
 
@@ -2030,7 +2103,7 @@ class MathInfo {
     m.mathSize = m.mathEnd - m.mathStart;
     entries_.push_back(m);
   }
-  bool empty() const { return entries_.empty(); };
+  bool empty() const { return entries_.empty(); }
   size_t getEndPos() const {
     if (entries_.empty() || (actualIdx_ >= entries_.size())) {
       return 0;
@@ -2065,7 +2138,7 @@ class MathInfo {
     }
     return entries_[actualIdx_].mathSize;
   }
-  void incrEntry() { actualIdx_++; };
+  void incrEntry() { actualIdx_++; }
 };
 
 void LatexInfo::buildEntries(bool isPatternString)
@@ -3984,14 +4057,14 @@ MatchResult findAdvFinalize(DocIterator & cur, MatchStringAdv const & match, Mat
              max_match.match_len = actual_match_len;
               maxl = len;
               if (maxl - minl < 4)
-                len = (int)((maxl + minl)/2);
+                len = (maxl + minl)/2;
               else
-                len = (int)(minl + (maxl - minl + 3)/4);
+                len = minl + (maxl - minl + 3)/4;
             }
             else {
               // (actual_match_len < max_match.match_len)
               minl = len + 1;
-              len = (int)((maxl + minl)/2);
+              len = (maxl + minl)/2;
             }
           }
          len = minl;