summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-12 18:27:30 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-12 18:27:30 +0200
commit4389ab9865d13e17ce3c66223d7c149437be692b (patch)
treeed27519df0e5dfce1ef1a13bfa30bc50efe2e2d3 /graphics
parentabab1448576fbfa4717b65cdf1455debf44f2df5 (diff)
downloadiced-4389ab9865d13e17ce3c66223d7c149437be692b.tar.gz
iced-4389ab9865d13e17ce3c66223d7c149437be692b.tar.bz2
iced-4389ab9865d13e17ce3c66223d7c149437be692b.zip
Fix cursor offset with `Affinity::After` at the end of lines in `Editor::cursor`
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/text/editor.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index 7b0ddec1..b39e9831 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -143,7 +143,10 @@ impl editor::Editor for Editor {
None
}
})
- .unwrap_or((0, 0.0));
+ .unwrap_or((
+ 0,
+ layout.last().map(|line| line.w).unwrap_or(0.0),
+ ));
let line_height = buffer.metrics().line_height;