summaryrefslogtreecommitdiff
path: root/library/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-03 10:33:18 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-03 10:33:18 +0200
commitad347632ab95e29eb5180b27142f5c264dfc611a (patch)
tree2742a33f4c3d800a86e977de04fa2cec7104c43f /library/src/layout
parentbcc014c4e177cc4e8cf5ca8c24990908b507c0f8 (diff)
Make ligatures copyable and searchable
Fixes #479 Fixes #1040
Diffstat (limited to 'library/src/layout')
-rw-r--r--library/src/layout/par.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index a6ad647b..0c3a9a3c 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -1139,8 +1139,7 @@ fn line<'a>(
// are no other items in the line.
if hyphen || start + shaped.text.len() > range.end {
if hyphen || start < range.end || before.is_empty() {
- let shifted = start - base..range.end - base;
- let mut reshaped = shaped.reshape(vt, &p.spans, shifted);
+ let mut reshaped = shaped.reshape(vt, &p.spans, start..range.end);
if hyphen || shy {
reshaped.push_hyphen(vt);
}
@@ -1162,8 +1161,7 @@ fn line<'a>(
// Reshape if necessary.
if range.start + shaped.text.len() > end {
if range.start < end {
- let shifted = range.start - base..end - base;
- let reshaped = shaped.reshape(vt, &p.spans, shifted);
+ let reshaped = shaped.reshape(vt, &p.spans, range.start..end);
width += reshaped.width;
first = Some(Item::Text(reshaped));
}