Commit 151edb8f authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Merge branch 'utf8-selection' into 'master'

Fixed incorrect string slicing that would screw up UTF-8 strings

Closes #335

See merge request World/fractal!234
parents 1793baba 483fd796
......@@ -363,7 +363,9 @@ fn get_selected_text(event_widget: Option<&gtk::Widget>) -> Option<SelectedText>
match w.get_selection_bounds() {
Some((s, e)) => {
let text = w.get_text()?;
let slice = text.get(s as usize..e as usize)?;
let slice: String = text.chars()
.take(e as usize).skip(s as usize)
.collect();
Some(SelectedText{ widget: w.clone(), text: slice.to_string(), start: s, end: e })
}
_ => None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment