Commit Graph

1085 Commits

Author SHA1 Message Date
Antonio Scandurra
0004dc6921 Remove remaining I/O nomenclature for DisplayMap coordinates 2021-07-26 11:19:36 +02:00
Antonio Scandurra
58054c605b Fix panic due to incorrectly calculating editor text size in layout 2021-07-26 11:04:22 +02:00
Nathan Sobo
61b5d66ba8 Eliminate input/output nomenclature from fold_map
Instead, just use FoldPoint, FoldOffset, etc. We don't need the naming to be general because we know exactly which layer we're building on at each layer of the DisplayMap.
2021-07-25 08:22:50 -06:00
Nathan Sobo
da50576129 Fix remaining errors and warnings 2021-07-25 07:56:53 -06:00
Nathan Sobo
9edc8b9a06 WIP 2021-07-24 08:40:48 -06:00
Nathan Sobo
3bf47be51e WIP 2021-07-24 08:09:04 -06:00
Nathan Sobo
f81f043058 WIP 2021-07-23 12:25:09 -06:00
Nathan Sobo
11285f3762 Pass a MutableAppContext to Element::layout and ::dispatch_event
We need to mutate the app in these cases to relay layout state, so this just makes things easier. We won't be able to perform layout in parallel but it's questionable whether we'll ever actually do that. If we do, we can revisit.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-23 10:52:08 -06:00
Antonio Scandurra
61f45800d3 Optimize Buffer::edits_since when the version hasn't changed
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-23 16:31:00 +02:00
Antonio Scandurra
14fcc26e73 Don't insert empty isomorphic transforms when interpolating
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-23 16:20:27 +02:00
Antonio Scandurra
a8db06426c Get wrapping randomized test passing with wrap width as small as 0
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-23 15:58:05 +02:00
Antonio Scandurra
174a546c18 Expand tabs correctly in TabMap's highlighted chunks iterator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-23 15:08:59 +02:00
Antonio Scandurra
502f54a021 Don't poll foreground futures during DeterministicExecutor::block_on 2021-07-23 12:06:58 +02:00
Antonio Scandurra
416571e8e0 Fix wrap map randomized tests 2021-07-23 11:26:53 +02:00
Max Brunsfeld
d61f26d03e Get randomized test compiling against new WrapMap structure
It doesn't pass.
2021-07-22 20:45:14 -07:00
Max Brunsfeld
53fd3a1a92 Move LineWrapper test to line_wrapper.rs 2021-07-22 20:42:18 -07:00
Max Brunsfeld
5d22c6c4bd Start restructuring WrapMap with simpler concurrency
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-22 16:21:42 -07:00
Antonio Scandurra
80f13dd737 WIP 2021-07-22 18:31:01 +02:00
Antonio Scandurra
f7c8864995 Fix panic in WrapMap::highlighted_chunks_for_rows
Also, add a unit test for `DisplayMap` with syntax highlighting when
soft wrap is on.
2021-07-22 10:08:29 +02:00
Max Brunsfeld
830f5336b9 Start work on wrapping lines without text shaping 2021-07-21 17:50:37 -07:00
Nathan Sobo
f169f8e358 Ensure that soft wrapped lines don't cause horizontal scrolling 2021-07-21 12:27:01 -06:00
Nathan Sobo
699e558db9 Remove logging 2021-07-21 11:21:13 -06:00
Antonio Scandurra
ef42d14b8c Fix WrapMap::clip_point at the end of a soft-wrapped line
If that's the case and `Bias` is `Left` we clip to the last
character of the soft-wrapped line.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-21 18:32:32 +02:00
Antonio Scandurra
915c710f94 Ensure that we use the WrapMap where appropriate in DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-21 18:04:58 +02:00
Antonio Scandurra
0875a86c69 Account for the impact of edits on tab expansion
Tab characters are expanded differently based on the column on which
they appear, which edits can affect. Thus, `TabMap::sync` will now
expand edits to the first tab that appears on the line in which the edit
occurred.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-21 17:18:15 +02:00
Antonio Scandurra
62ad97a728 Add randomized test for DisplayMap::buffer_rows and fix logic errors 2021-07-21 14:45:25 +02:00
Max Brunsfeld
72fdd3fb9a Start rendering highlighted text and line numbers via the wrap map
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 18:03:02 -07:00
Nathan Sobo
b513df3844 WIP 2021-07-20 17:22:03 -06:00
Max Brunsfeld
07e97e6cad wip 2021-07-20 15:30:50 -07:00
Max Brunsfeld
d0fdc7b5e8 Get simple unit test passing for soft-wrap in DisplayMap 2021-07-20 15:22:11 -07:00
Max Brunsfeld
7832562675 Add WrapMap as a member of DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 13:03:59 -07:00
Max Brunsfeld
dbc8fc3bfa Fix assertions in fold map test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 11:43:10 -07:00
Max Brunsfeld
61397f2f2f Avoid holding executor's state lock while parked
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 11:37:02 -07:00
Nathan Sobo
ee213696aa Replace DeterministicExecutor::reset with forbid_parking
There's really no point calling reset if we plan on parking afterwards.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-20 12:28:04 -06:00
Nathan Sobo
64927abbc4 Allow DeterministicExecutor to park until forbid_parking is called
This allows us to perform async setup such as talking to the database.
2021-07-20 12:22:02 -06:00
Antonio Scandurra
f6263768b3 WIP: interpolate edits into snapshot coming from BackgroundWrapper
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-20 19:21:52 +02:00
Antonio Scandurra
3d3a14b650 Add DeterministicExecutor::block_on(duration, future)
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-20 19:20:50 +02:00
Antonio Scandurra
3d8c59af31 Implement Snapshot::interpolate 2021-07-20 14:25:56 +02:00
Antonio Scandurra
b66de06d0e Ensure that WrapMap's input lines match TabMap's output lines 2021-07-20 11:30:00 +02:00
Antonio Scandurra
d0113a114c Coalesce contiguous isomorphic transforms 2021-07-20 11:27:12 +02:00
Antonio Scandurra
3d845f81b1 Remove stray logging statements 2021-07-20 11:10:02 +02:00
Antonio Scandurra
39b73496cb Make randomized tests pass with one operation 2021-07-20 11:06:17 +02:00
Nathan Sobo
3b77b011e2 Iterate on randomized wrapping test and fix some bugs
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-19 19:31:03 -06:00
Nathan Sobo
e0da3fd714 Get the randomized soft wrap test passing with no edits
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-19 18:37:29 -06:00
Nathan Sobo
2ce42ff6b6 Honor the last line when wrapping even if it doesn't end in \n
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-19 18:29:20 -06:00
Max Brunsfeld
f9e13f3429 Start work on WrapMap::chunks_at
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-19 16:23:56 -07:00
Max Brunsfeld
8e9a5e072d Fix typo in Point::add_assign 2021-07-19 13:28:35 -07:00
Nathan Sobo
e193a660aa WIP 2021-07-19 13:59:07 -06:00
Antonio Scandurra
5a33612f0f WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-19 19:34:41 +02:00
Antonio Scandurra
631a6a2f45 Re-enable wrap_map module and fix compile errors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-19 18:40:57 +02:00