Commit Graph
44 Commits
Author SHA1 Message Date
Kay Simmons 216b1aec08 fix replace in normal and visual modes 2023-01-11 14:57:40 -08:00
Max BrunsfeldandMikayla Maki 8df84e0341 Add MovePageUp and MovePageDown editor commands
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2022-10-14 12:36:46 -07:00
Max Brunsfeld 6cdf4e98fc Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Mikayla Maki 41590ef64b Merge branch 'main' into test-branch 2022-10-11 19:55:32 -07:00
Mikayla Maki 0beb97547e Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
K Simmons b82db3a254 Adds word and sentence text objects along with a new vim testing system which uses cached neovim data to verify our test accuracy 2022-10-08 21:51:49 -07:00
Max Brunsfeld 26fdaeb92b Use new marked ranges format whenever we don't need overlapping ranges 2022-08-04 10:23:03 -07:00
Max Brunsfeld 87ba68e3ea Merge pull request #1155 from zed-industries/golang
Add Go support
2022-06-09 14:18:37 -07:00
Max Brunsfeld f62fd3cddd Add support for hard tabs
* Add a `hard_tabs` setting that causes indentation to be performed
  using a tab instead of multiple spaces.
* Change Buffer's indentation-related APIs to return an `IndentSize`
  struct with a length and a kind, instead of just a single u32.
* Use hard tabs by default in Go.
2022-06-08 18:30:10 -07:00
Antonio Scandurra 15b13fe511 Introduce an optional primary field to ExcerptRange 2022-06-08 12:23:12 +02:00
Antonio Scandurra ffb75b0f02 Extract an ExcerptRange containing a context field in multi_buffer
This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
2022-06-08 12:13:04 +02:00
Keith Simmons 5ea782de21 Add inclusive vs exclusive motions to vim mode 2022-04-21 16:50:23 -07:00
Keith Simmons 1812480cbb Tab size is pulled properly from settings instead of hardcoded 2022-04-06 10:23:37 -07:00
Keith SimmonsandNathan Sobo 0aaf270650 Add clip_to_line_end to display_map/snapshot and set it to ensure vim positioning in normal mode
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:52 -07:00
Keith Simmons df751867a1 Remove results from movement function return values, and move editor test utilities to test file 2022-03-22 10:55:03 -07:00
Nathan Sobo ee3e6049a3 Make boundary-finding methods wrap across newlines
This requires word and subword methods to explicitly acknowledge that they want to stop at newlines, which I think actually increases clarity. It makes the boundary finding method more general and useful for external callers such as the forthcoming vim crate.
2022-03-21 21:25:02 -06:00
Nathan Sobo e5a00d72f8 Implement next_subword_end 2022-03-21 20:02:08 -06:00
c0d05c82b7 WIP: Start on previous_subword_start
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 19:53:01 -06:00
Nathan Sobo 5b54874705 Extract logic for scanning over character boundaries 2022-03-21 16:01:22 -06:00
Nathan Sobo 0c89ad3ac0 Make multi-byte and surrounding_word tests more readable
Just merge multi-byte tests into the main word movement tests
2022-03-21 15:41:42 -06:00
Nathan SoboandKeith Simmons 210fa4c443 Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines.

/cc @as-cii

Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:32 -06:00
Nathan SoboandKeith Simmons baeb7d27b8 Clarify word movement function names and improve test coverage
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:25 -06:00
Max BrunsfeldandNathan Sobo 471c23e22f Allow inserting multiple excerpts in a batch
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:56:06 -08:00
Max BrunsfeldandNathan Sobo aa7dfbdd9c Remove ExcerptProperties struct
Pass buffer and range as separate parameters

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:52:17 -08:00
Max Brunsfeld 5b4c0d64bc Get tests passing and project diagnostics view working w/ new excerpt headers 2022-02-09 13:51:52 -08:00
Antonio Scandurra 0e1318dfe4 WIP: Make editor crate compile again
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Nathan SoboandAntonio Scandurra c38fe473cd Delete to hard line boundary when deleting to start/end of line
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 10:10:30 -07:00
Nathan SoboandAntonio Scandurra 90a780a604 Improve moving to start or end of soft-wrapped lines
When moving to end, stop at the soft-wrap line boundary first, then move to the end of the hard line. Vice versa when moving to the beginning.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 09:52:50 -07:00
Antonio ScandurraandNathan Sobo b89a39bcb3 Filter and sort suggestions in autocomplete
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Antonio Scandurra bcbd265de9 Dismiss autocomplete when moving outside of a word 2022-02-01 13:27:49 +01:00
Antonio Scandurra b980b11053 Implement whole word mode 2022-01-28 11:48:04 +01:00
Antonio Scandurra 2b31a48ef9 Clip right when moving to next word in case we land on a block line 2022-01-04 15:17:37 +01:00
Antonio ScandurraandMax Brunsfeld eec1748dc7 Render excerpt headers using DisplayMap::insert_blocks
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-21 18:32:27 +01:00
Max Brunsfeld 38df091b06 Fix up/down movement across excerpt headers
Implement these movements in terms of clipping, instead of with explicit loops
2021-12-16 11:16:48 -08:00
Nathan Sobo c8b43e3078 Move multi_buffer to editor crate 2021-12-10 17:37:53 -07:00
Nathan SoboandMax Brunsfeld 87d16c271e Get Editor compiling with MultiBuffer as its buffer
There's a bunch of unimplemented methods in MultiBuffer, but everything compiles.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-08 19:23:04 -07:00
Max Brunsfeld fa379885f1 Give more specific names to all snapshot and text iterator types 2021-12-08 09:24:00 -08:00
Max Brunsfeld 924e1578ea Use &Snapshot directly instead of impl Into<Content<'a>>
The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
2021-11-30 13:32:11 -08:00
Nathan SoboandMax Brunsfeld d3f28166cb Rename buffer crate to text and name its entrypoint after the crate
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:26:12 -07:00
Antonio Scandurra 7a79df7a24 Implement line-wise selection 2021-11-23 19:10:15 +01:00
Antonio ScandurraandNathan Sobo bcf38e6bb5 Implement word-wise mouse selection
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-23 18:50:17 +01:00
Antonio Scandurra a0ea5b38a0 Add a new movement::surrounding_word function 2021-11-23 17:04:37 +01:00
Antonio ScandurraandNathan Sobo 0f1eb3dd2e Skip block lines when moving up and down
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 13:45:06 +01:00
Max BrunsfeldandNathan Sobo 1d97f08901 Move editor into its own crate
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 15:23:10 -07:00