Explorar o código

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

darkfi hai 1 ano
pai
achega
38a170a000
Modificáronse 1 ficheiros con 2 adicións e 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)