Commit graph

65 commits

Author SHA1 Message Date
Hojjat
626f44dad8 feat: buffer setter methods are now lazy 2026-03-26 20:48:52 -06:00
Jeremy Soller
9339446cfa
Add Renderer trait for more flexible rendering of buffers and editors 2025-11-06 11:23:11 -07:00
romanstingler
a2f1f4b2a0
refactor: address clippy warnings and improve code quality (#409)
- Fix string formatting with modern interpolation syntax
- Improve Debug implementation with finish_non_exhaustive()
- Fix function placement in shape.rs to avoid items_after_statements warning
- Use more idiomatic Rust patterns (map_or_else, next_back)
- Clean up conditional imports in vi.rs
- Convert multiple methods to `const` functions for optimization and consistency
- Introduce `core_maths` for enhanced no-std compatibility
- Update `Cargo.toml` for the new optional dependency and feature adjustments
2025-08-11 13:58:59 -06:00
romanstingler
e80dbc3607
Optimize BidiParagraphs with ASCII fast path (#408)
* Optimize BidiParagraphs with ASCII fast path - Added fast path for ASCII text that avoids BidiInfo allocation - Added some text shaping benchmarks

* refactor: fix clippy warnings and cleanup imports
2025-08-11 13:15:09 -06:00
dsgallups
f05a69a9d9 resolve all lints, update MSRV 2025-01-22 17:00:01 -07:00
Jeremy Soller
93a7df859a Allow for undefined buffer width and/or height, fixes #70 2024-06-12 09:14:56 -06:00
Pavel Strakhov
a3a6262e5d Add Edit::cursor_position 2024-06-10 10:39:58 -06:00
Jeremy Soller
3c94352f3f Support expanding tabs 2024-06-10 08:12:42 -06:00
Jeremy Soller
37688747e1 Use line height from attrs 2024-06-06 19:38:40 -06:00
Joshua Megnauth
ff5501d9a3
Fix: Undo and redo correctly updates editor modified status (#244)
* Set an index for the last saved change

I added an index that represents the last saved change.

Editors are considered to be unsaved or modified if the current change
is different from the save index. In other words, if the last saved
change is `5`, undoing or redoing past that change should indicate that
the editor has been modified.

This is needed to fix two bugs in COSMIC Edit:
* https://github.com/pop-os/cosmic-edit/issues/116
* https://github.com/pop-os/cosmic-edit/issues/128

* Unit test that confirms pivot logic works

I'll most likely simplify the API as end users don't have a way to
cleanly use `Pivot::Exact` without access to the internal command
buffer.

* Simplify save point API

* Implement more save point unit tests

A unit test for an edge case currently fails but normal usage works.

* Fix edge case for empty command index and pivot

* More save point unit tests for common use cases
2024-03-25 08:55:44 -06:00
Jeremy Soller
b08676909f
Remove todos about highlight color, it is implemented 2024-03-18 08:41:42 -06:00
Jeremy Soller
0a11fb1045 Make Editor::buffer_ref accessible, rename lifetimes 2024-01-17 13:31:03 -07:00
Jeremy Soller
cbbf6f0d8f Allow Editor to use reference or Arc of Buffer 2024-01-17 13:31:03 -07:00
Jeremy Soller
ae030e9885 Move color and x_opt out of Cursor 2024-01-17 13:31:03 -07:00
Jeremy Soller
d0b4b4635e Refactor of scroll and shaping
- Scroll is identified by line index and layout index, instead of just
  layout index
- Shaping has the option to prune, where caches outside of the scroll
  view are cleared
- Syntax editor no longer requires layout of all lines, only of lines
  inside scroll
- BufferLine has a metadata field that can be used by other abstractions
  to know when text was changed
2024-01-17 13:31:03 -07:00
Jeremy Soller
018a2e9d2a Move cursor motions to new Motion enum, move handling to Buffer 2024-01-17 13:31:03 -07:00
Jeremy Soller
94e6cdefda
Add select by word and double/triple click actions 2023-12-12 10:29:14 -07:00
Jeremy Soller
6566350276
ViEditor::finish_change will store change to history 2023-12-12 09:52:22 -07:00
Jeremy Soller
3187e916ab
ViEditor: cleanup logging 2023-12-08 12:03:55 -07:00
Jeremy Soller
b7bdd62eb3
ViEditor: update modit and improve put implementation 2023-12-05 10:05:26 -07:00
Jeremy Soller
de6f2c7fbe
Editor: make delete_range and insert_at methods public 2023-12-05 10:04:50 -07:00
Jeremy Soller
9278e7d0c4
ViEditor: Implement put/yank registers 2023-11-30 13:42:52 -07:00
Jeremy Soller
cbd567d238
Support line selection 2023-11-28 10:42:50 -07:00
Jeremy Soller
7d21045b2f
Add primitive auto indent 2023-11-16 08:59:43 -07:00
Jeremy Soller
1207fd6d80
Edit: use u16 for tab_width 2023-11-16 08:38:48 -07:00
Jeremy Soller
38bed64ef1
Use cosmic_undo_2 instead of undo_2 for improved compiler support 2023-11-15 09:09:46 -07:00
Jeremy Soller
abf58279be
Implement TextObject::Search 2023-11-14 13:23:00 -07:00
Jeremy Soller
bab94a7823
Join together vim changes 2023-11-14 12:28:56 -07:00
Jeremy Soller
4c85a6be72
ViEditor: Track when changed 2023-11-13 14:46:46 -07:00
Jeremy Soller
5352fdee94
Undo/redo support in ViEditor 2023-11-13 13:31:06 -07:00
Jeremy Soller
7830f4107c
Enable external change tracking 2023-11-13 12:37:07 -07:00
Jeremy Soller
e942e649ed
Support LeftInLine and RightInLine motions 2023-11-13 11:10:05 -07:00
Jeremy Soller
d001e5c09e Implement all modit motions required 2023-11-12 19:01:20 -07:00
Jeremy Soller
fbc33c183a
Convert more actions to modit keys, fix passthrough 2023-11-10 15:53:19 -07:00
Jeremy Soller
ddcd3c8795
Support search 2023-11-10 12:23:00 -07:00
Jeremy Soller
e8dd8ec7d1
Support modit::Key enum 2023-11-10 09:47:45 -07:00
Jeremy Soller
9efcc41a5a
Remove unused import and implemented todo 2023-11-09 09:35:04 -07:00
Jeremy Soller
d7e066c105
Support more modit events 2023-11-08 14:23:13 -07:00
Jeremy Soller
aece6486b9
Adapt to newer modit 2023-11-08 11:57:02 -07:00
Jeremy Soller
fa83b2efe9
Support NextChar and PreviousChar modit motions 2023-11-08 11:03:53 -07:00
Jeremy Soller
74c92e0419 ViEditor: switch to using modit 2023-11-07 15:57:00 -07:00
Jeremy Soller
ac389d9eeb
SyntaxEditor: Allow retrieving syntax theme, optimize updates to theme 2023-11-02 12:55:45 -06:00
Jeremy Soller
ca35e1f429
ViEditor: redraw when passthrough mode changed 2023-11-01 14:17:37 -06:00
Jeremy Soller
7855dce09d
Add indent action and tab width 2023-11-01 13:31:53 -06:00
Jeremy Soller
d53932bd7c Add function to set metrics and size simultaneously 2023-10-31 20:40:46 -06:00
Jeremy Soller
423fc22439
ViEditor: fix cursor and select positions 2023-10-27 13:17:56 -06:00
Jeremy Soller
c1e40363ab
ViEditor: implement search, capture commands 2023-10-20 14:11:18 -06:00
Jeremy Soller
37789ccdf7
ViEditor: expose current mode, add word stubs 2023-10-20 12:34:03 -06:00
Jeremy Soller
a29eefca5a
ViEditor: implement I and ^ using SoftHome 2023-10-20 10:26:17 -06:00
Jeremy Soller
c6e4f9d04c
ViEditor: add passthrough mode (disables vi features) 2023-10-20 09:46:21 -06:00