Explorar el Código

wallet/chatedit: minor bugfix when selecting word at the end of a line and you get OOB error.

darkfi hace 1 año
padre
commit
38a170a000
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      bin/darkwallet/src/ui/chatedit.rs

+ 2 - 2
bin/darkwallet/src/ui/chatedit.rs

@@ -178,13 +178,13 @@ impl TextWrap {
         }
 
         // Find word end
-        let mut pos_end = pos;
+        let mut pos_end = pos + 1;
         while pos_end < rendered.glyphs.len() {
-            pos_end += 1;
             let glyph_str = &rendered.glyphs[pos_end].substr;
             if is_whitespace(glyph_str) {
                 break
             }
+            pos_end += 1;
         }
 
         (pos_start, pos_end)