Parcourir la source

fix n - 1 crash

David Rose il y a 18 ans
Parent
commit
b7a15f13c8
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      panda/src/text/textAssembler.cxx

+ 6 - 1
panda/src/text/textAssembler.cxx

@@ -408,7 +408,12 @@ calc_r_c(int &r, int &c, int n) const {
   const TextRow &row = _text_block[r];
   bool is_real_char = true;
 
-  if (row._got_soft_hyphens) {
+  if (n == 0) {
+    // If there are no characters before n, no need to mess with soft
+    // hyphens.
+    c = row._string.size();
+    
+  } else if (row._got_soft_hyphens) {
     // If there are any soft hyphen or soft break keys in the source
     // text, we have to scan past them to get c precisely.
     c = 0;