Commit graph

830 commits

Author SHA1 Message Date
Jeremy Soller
c24886c247 0.19.0
Some checks failed
Pages / pages (push) Has been cancelled
Rust / cargo-deny (push) Has been cancelled
Rust / build (push) Has been cancelled
2026-04-22 13:17:01 -06:00
Hojjat
4d74f795cc chore: update hashbrown 2026-04-09 17:59:26 -06:00
Hojjat
83e8bd237a fix: clamp scroll.line to a valid range 2026-04-09 16:41:52 -06:00
Hojjat
9a2ab09f06 fix: fallback to a default font in basic shaping mode 2026-04-04 07:00:53 -06:00
Rasmus Kildevæld
9a5579f523 Import CoreFloat when no_std is enabled 2026-04-01 10:25:56 -06:00
Rasmus Kildevæld
158d8ba518 Add swash libm feature to the no_std feature list 2026-04-01 10:25:56 -06:00
Hojjat
19e029a58a feat: add cursor_position and is_rtl methods to buffer
cursor_position returns (x,y) of the cursor. This is needed for clients
that do not want to use a fully fledged editor (for example TextInput in
Iced).

is_rtl is necessary to know the base direction of a paragraph.
2026-04-01 10:25:30 -06:00
Josh Ricker-Rampersad (jrampersad_pins)
463387d6a1 Remove 1px horizontal offset on pixel fonts 2026-03-31 15:33:13 -06:00
Hojjat
1abcf67e17 fix: shape_until_scroll if a buffer_line is modified 2026-03-31 14:47:11 -04:00
khyperia
5651c2d967 Optimize shape_until_scroll with large line count 2026-03-26 20:57:46 -06:00
Hojjat
626f44dad8 feat: buffer setter methods are now lazy 2026-03-26 20:48:52 -06:00
Hojjat
e5926aec74 fix(hit): move cursor to the logical end of mixed-bidi line 2026-03-26 20:47:54 -06:00
Hojjat
aa2c305039 fix: selection and highlight for mixed bidi text
Fixes two issues:
- When writing RTL text in an LTR line the carret disappears since the
last glyph is not necessarily at the end of the line
- `highlight()` used to return just one (x_left, x_width) but in Bidi
text you can't draw the selection rectangle with only one rectangle.
This issue wasn't visible before because Editor was drawing the
selection rectangle per glyph and not using `highlight()` method
2026-03-26 20:47:54 -06:00
Andy Terra
d5a972a2b6 Pass pre-normalized coords to the swash scaler for variable fonts 2026-03-13 12:39:17 -06:00
Jeremy Soller
ddad5fb741 Add pull request template 2026-03-10 13:10:57 -06:00
Andy Terra
b6216ad123 Add regression test for variable font weight matching 2026-03-06 17:01:35 -07:00
Andy Terra
d2e3794fa8 Log when default font family match fails due to weight mismatch
Uses missing_warn! (debug or warn depending on warn_on_missing_glyphs
feature) to surface when a requested family cannot be matched at the
desired weight, which is the root cause of variable font fallback
issues.
2026-03-06 17:01:35 -07:00
Andy Terra
5b9e2f2588 Fix variable font weight matching in FontMatchKey
Add variable_weight_match flag to FontMatchKey: when a face has a
wght axis covering the requested weight, let it pass the
font_weight_diff == 0 filter without altering sort priority.

The check is done inline via db.with_face_data() in FontMatchKey::new()
so it participates in the existing font_matches_cache invalidation —
no separate caching needed.
2026-03-06 17:01:35 -07:00
Héctor Ramón Jiménez
29034e56b4 Avoid breakage in LayoutRunIter::new 2026-02-27 13:59:18 -07:00
Héctor Ramón Jiménez
02137a7561 Move LayoutRun back to buffer module 2026-02-27 13:59:18 -07:00
Héctor Ramón Jiménez
1fca62bdc3 Implement layout_runs for BufferLine 2026-02-27 13:59:18 -07:00
Hojjat
b0884c0ab1 fix: find decoration spans in bidi text 2026-02-24 19:34:51 -07:00
Hojjat
0666ba14b1 improv: ShapeSpan::decoration_spans holds user-level attrs 2026-02-24 19:34:51 -07:00
Hojjat
e8a6b0cc60 chore: porting to decoration span
fix: BiDi Text Decoration

improv: don't use glyph decorations at all
2026-02-24 19:34:51 -07:00
Hojjat
abdbad308f test: text decoration for bidi text is different
test: bidi and rtl tests for text decoration
2026-02-24 19:34:51 -07:00
Hojjat
af2d269636 fix: import ceil for no_std 2026-02-24 19:34:51 -07:00
Hojjat
61f001b0f7 test: text decoration test 2026-02-24 19:34:51 -07:00
Hojjat
78665aab3b perf: minimize the performance impact of text decoration
Boxed the decoration data to go from 40b to 8b.
The performance is almost unchanged for text without decoration.
2026-02-24 19:34:51 -07:00
Hojjat
6ef1ccbeed improv text decoration visuals 2026-02-24 19:34:51 -07:00
Hojjat
c12b3a9bf2 improv: extract decoration metrics from the font 2026-02-24 19:34:51 -07:00
Hojjat
2758919c80 feat: add TextDecoration rendering 2026-02-24 19:34:51 -07:00
Hojjat
2edae7ef1d feat: add TextDecoration type 2026-02-24 19:34:51 -07:00
Hojjat
892f98cffe ci: ignore bincode being unmaintained 2026-02-24 15:45:42 -07:00
Hojjat
7c2ebf37fc fix: empty lines use span metrics 2026-02-24 14:09:08 -07:00
Jeremy Soller
f31b9d8695 0.18.2 2026-02-20 15:46:09 -07:00
Hojjat
a8873a0536 improv: show ellipsis if nothing else fits
If buffer is small enough that char+ellipsis doesn't fit, then show
ellipsis alone. If buffer is smaller than ellipsis, show nothing.
2026-02-20 15:37:30 -07:00
Hojjat
d304a49536 fix: width 0.0 is valid,return ellipsized if there's non-zero content 2026-02-20 15:37:30 -07:00
Hojjat
a24c55a483 chore: remove unenecessary log and code
After previous fix, there is not need to check to see if ellipsize
middle actually happened. If we reach here, it happened.
2026-02-20 14:23:48 -07:00
Nick
9c2c84432d
Remove completely unnecessary boxing/dyn of ranges introduced in last change. (#473)
Update shape.rs
2026-02-20 13:40:22 -07:00
Hojjat Abdollahi
29ac278e76
fix: off by one in fit_glyphs (#474) 2026-02-20 13:27:42 -07:00
Jeremy Soller
cc73876fc9 0.18.1 2026-02-20 12:17:18 -07:00
Hojjat Abdollahi
e83bd7f7bf
Merge pull request #471 from hojjatabdollahi/hojjat/fix-bidi-zw
Fix aggressive ellipsizing
2026-02-20 12:14:00 -07:00
Jeremy Soller
cd1d3aa1ef 0.18.0 2026-02-19 09:31:45 -07:00
Jeremy Soller
5528523182 Fix compilation for no_std 2026-02-19 09:15:06 -07:00
Hojjat Abdollahi
4819bc30fa
Ellipsize (#467)
* feat: add Ellipsize enum

* chore: API changes needed for ellipsize

Decided not to change "layout()" function for now to avoid breaking the
interface. For now.

* chore: shape ellipsis

* feat: Ellipsize::Start

Since it can only have 1 line, it's easier to implement.

* DROPME: temporarily change rich-text for testing

* test(ellipsize): Testing Ellipsize::Start

Long text in small buffer should produce ellipsis glyphs

* fix: do not need font_system anymore

We moved ellipsis shaping elsewhere so no need to pass font_system to
layout function (which also was recreating a new one in the tests every
time making them take forever).

* feat: Ellipsize::End

* improv(ellipsize): use a single ellipsis shape

* improv: Ellipsie::End && Wrap::None

There is no need to layout the whole line if it's not going to fit.

* fix: mixed bidi text when Ellipsize::End && Wrap::None

* chore: clean up and simplify when line.RTL==span.RTL

* fix(ellipsize): last word is not (word_count -1) if iter().rev()

* refactor(layout): extract the layout algorithm to make it more readable

* improv(ellipsize): Ellipsize::Start && Wrap::None

we iterate in reverse and only layout what's going to be visible

* Revert: delete the previous approach of post processing ellipsis

* doc: explain the interaction between Ellipsize and Wrap

* chore: lower the scope

* feat: Ellipsize the last line of a paragraph

For now only the number of lines is supported

* fix: clear ellipsized field on visual lines

This was causing ellipsis to show on random lines

* chore: remove old tests

will add better tests soon

* chore: clean up changes from previous attempt

* fix: consider the ellipsis width when doing alignment

* feat(ellipsize): add `Height` limit to `Ellipsize`

* fix: ellipsize the start of the last line correctly

* fix: ellipsize at the start of mixed bidi lines

* feat: Ellipsize::Middle

* fix: consider ellipsize::middle when calculating alignment correction

* refactor: improve readability

* refactor: deduplicate "fit_glyphs"

* refactor: combine backward and forward layout into one (wip)

* fix: Backward works in the unified layout_spans

* chore: clean up

* fix: Ellipsize::Middle

* fix: handle large words in bidi boundaries

* chore: clean up and some refactoring

* fix: ellipsis is now the same level as the surrounding text

* fix: try to fit more when ellipsizing::middle

* improv: ellipsis now have the same level as the neighbors

This makes ellipsized RTL text inside a LTR line more readable.

before:

Hello سلام...خوبی؟
Hello خولی؟...سلام

* fix: some extra words were being rendered in Ellipsize::Middle

This was causing the last word (if it's not the same level as the rest)
to be rendered outside the buffer.

* test: a few test cases for ellipsize

* fix: assign the correct byte range to ellipsis

this should fix the panic when selecting or clicking on or near the
ellipsis in the editor.
2026-02-19 09:11:22 -07:00
Jeremy Soller
4fd11f0e5e 0.17.2 2026-02-18 15:41:27 -07:00
Jeremy Soller
82fadd954c Make Motion::Home and Motion::End operate on unwrapped lines, fixes #468 2026-02-18 15:39:41 -07:00
Jeremy Soller
d7dc22dd20
Fix 0.17.1 date in changelog 2026-01-30 15:58:56 -07:00
Jeremy Soller
ae8f1c0737
0.17.1
- Set correct rust-version to 1.89
- Update all dependencies to latest versions
2026-01-30 15:57:17 -07:00
Jeremy Soller
bdd6657fd7
0.17.0 2026-01-29 09:48:18 -07:00