Commit Graph

313 Commits (b581c185ba404e5c3c99affecb06bfd7e7b06c26)

Author SHA1 Message Date
Ivan Tham f7c8500797 Fix append newline indent
Fix #492
3 years ago
Blaž Hrastnik 63e54e30a7 Implement in-memory prompt history
Implementation is similar to kakoune: we store the entries into
a register.
3 years ago
Omnikar 112ae5cffe
Determine whether to use a margin of 0 or 1 when uncommenting (#476)
* Implement `margin` calculation for uncommenting

* Move `margin` calculation to `find_line_comment`

* Fix comment bug with multiple selections on a line

* Fix `find_line_comment` test for new return type

* Generate a single vec of lines for comment toggle

`toggle_line_comments` collects the lines covered by all selections into
a `Vec`, skipping duplicates. `find_line_comment` now returns the lines
to operate on, instead of returning the lines to skip.

* Fix test for `find_line_comment`

* Reserve length of `to_change` instead of `lines`

The length of `lines` includes blank lines which will be skipped, and as
such do not need space for a change reserved for them. `to_change`
includes only the lines which will be changed.

* Use `token.chars().count()` for token char length

* Create `changes` with capacity instead of reserving

* Remove unnecessary clones in `test_find_line_comment`

* Add test case for 0 margin comments

* Add comments explaining `find_line_comment`
3 years ago
fossdd d4bd5b3766 The item `fmt` was imported redundantly
Fixed warning:

```
warning: the item `fmt` is imported redundantly
  --> helix-core/src/syntax.rs:98:9
   |
16 |     fmt,
   |     --- the item `fmt` is already imported here
...
98 |     use std::fmt;
   |         ^^^^^^^^
   |
```
3 years ago
Blaž Hrastnik bf43fabf65 Remove ExactSizeIterator requirement on Transaction::change
Size hint is enough.
3 years ago
Cor Peters cd65a48635
Made toggle_comments language dependent (#463)
* Made toggle_comments language dependent

* Fixed Test Cases

* Added clippy suggestion

* Small Fixes

* Clippy Suggestion

Co-authored-by: Cor <prive@corpeters.nl>
3 years ago
Cor Peters 0aa43902ca
Added option to provide a custom config file to the lsp. (#460)
* Added option to provide a custom config file to the lsp.

* Simplified lsp loading routine with anyhow

* Moved config to language.toml

* Fixed test case

* Cargo fmt

* Revert now-useless changes

* Renamed custom_config to config

Co-authored-by: Cor <prive@corpeters.nl>
3 years ago
Blaž Hrastnik dd2903ff10 Dynamically load grammar libraries at runtime 3 years ago
Kirawi 084a8a9522
Rewritten Rust `highlights.scm` (#425)
* rewrote Rust highlights.scm

* wip

* wip

* wip

* wip

* fixed type highlighting

* wip

* rewrite again

* moved operators

* missing newline

* missing newline

* update book

* fix constructor highlighting

* fix constructor highlighting

* fix const highlighting

* better constructor highlighting

* remove dup, bug was my locals.scm file

* fixed docs

* merge

* fixed for highlighting

* add yield

* remove yield

* added yield back

* fixed yield highlighting

* unecessary
3 years ago
dependabot[bot] c8681a820c Bump unicode-segmentation from 1.7.1 to 1.8.0
Bumps [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/unicode-rs/unicode-segmentation/releases)
- [Commits](https://github.com/unicode-rs/unicode-segmentation/compare/1.7.1...v1.8.0)

---
updated-dependencies:
- dependency-name: unicode-segmentation
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years ago
Ivan Tham 6ccfa229ed Fix typo on comment in surround 3 years ago
Gokul Soumya 351c1e7e55 Fix surround bug when cursor on same pair
For example when the cursor is _on_ the `'` in `'word'`, the cursor
wouldn't move because the search for a matching pair started _from_ the
position of the cursor and simply found itself.
3 years ago
Gokul Soumya c68fe1f2a3
Add object selection (textobjects) (#385)
* Add textobjects for word

* Add textobjects for surround characters

* Apply clippy lints

* Remove ThisWordPrevBound in favor of PrevWordEnd

It's the same as PrevWordEnd except for taking the current char
into account, so use a "flag" to capture that usecase

* Add tests for PrevWordEnd movement

* Remove ThisWord* movements

They did not preserve anchor positions and were only used
for textobject boundary search anyway so replace them with
simple position finding functions

* Rewrite tests of word textobject

* Add tests for surround textobject

* Add textobject docs

* Refactor textobject word position functions

* Apply clippy lints on textobject

* Fix overflow error with textobjects
3 years ago
Kirawi c5b2973739
`:reload` (#374)
* reloading functionality

* fn with_newline_eof()

* fmt

* wip

* wip

* wip

* wip

* moved to core, added simd feature for encoding_rs

* wip

* rm

* .gitignore

* wip

* local wip

* wip

* wip

* no features

* wip

* nit

* remove simd

* doc

* clippy

* clippy

* address comments

* add indentation & line ending change
3 years ago
Perry Thompson e177b27baf Add missing import 3 years ago
Nathan Vegdahl 9f62ad0715 Fixed last `unused` warning. 3 years ago
Nathan Vegdahl c389f41f14 Fix one of the two remaining warnings.
One of them was a lot more obvious than I thought.
3 years ago
Nathan Vegdahl 220bc85821 Fix all remaining warnings in helix-core except for two.
I'm not sure how to address them, because they look like they
might be bugs, and code is involved.  Will poke the relevant people.
3 years ago
Nathan Vegdahl b571f28641 Remove #[allow(unused)] from helix-core, and fix unused imports.
Still a bunch more warnings to fix in core, but it's a start.
3 years ago
Blaž Hrastnik 3007478567 fix: Correctly merge multiple selection ranges together
Fixes #391
3 years ago
PabloMansanet de8745aea7 Incorporate long word commands into keymap 3 years ago
PabloMansanet 73572b7780 Add long word unit tests 3 years ago
PabloMansanet 073517a92f Add long word motion implementation 3 years ago
Blaž Hrastnik 51162ae6b2 fix ca98210d20 3 years ago
Blaž Hrastnik ca98210d20 fix: insert() | delete() would calculate the new insert incorrectly
Refs #386
3 years ago
Blaž Hrastnik d4e1ec339e Don't crash if diagnostics span past EOF 3 years ago
Blaž Hrastnik 1b102d5532 Extract the merge "operator" into helix-core 3 years ago
Blaž Hrastnik 44566ea812 Release 0.3.0 3 years ago
Nathan Vegdahl a6cadddef4 Fix silly mistake in previous phantom line bug fix.
Fixes #381.  I was trying to change an index value that... wasn't
even an index value.
3 years ago
Nathan Vegdahl 2dba228c76 Fix highlight code splitting graphemes.
This resulted in phantom blank lines in files with CRLF line
endings, but could potentially have manifested with other
graphemes as well.
3 years ago
Gokul Soumya 394629ab73 Skip enclosed pairs in surround
Surround operations previously ignored other pairs that are
enclosed within which should be skipped. For example if the
cursor is on the `,` in `{{a},{b}}`, doing `md{` previously
would delete the `{` on the left of `a` and `}` on the right
of `b` instead of the outermost braces. This commit corrects
this behavior.
3 years ago
Nathan Vegdahl 9cbf564d08 Handle erroneously ignored case in RopeGraphemes iterator. 3 years ago
Blaž Hrastnik 7f6265ecf3 fix: crash with ctrl-c on empty file 3 years ago
Shafkath Shuhan fd98e743e8 Handle non-UTF8 files 3 years ago
Nathan Vegdahl 38bf9c2576 Missed some items in the CRLF PR. 3 years ago
Blaž Hrastnik 9c53461429 fix: Select matching at the start of the doc could crash. Fixes #346 3 years ago
Gokul Soumya 892c80771a Correctly identify pairs when cursor on pair 3 years ago
Gokul Soumya 86271bac18 Refactor and add tests for surround 3 years ago
Gokul Soumya 4754b2e5ae Add more surround pair characters 3 years ago
Gokul Soumya 13648d28b9 Add surround keybinds 3 years ago
Nathan Vegdahl f2954fa153 Flesh out the line ending utility unit tests. 3 years ago
Nathan Vegdahl 7c4fa18764 Fix clippy warnings. 3 years ago
Nathan Vegdahl 07e28802f6 Add function to get the line ending of a str slice.
This is needed in some places.
3 years ago
Nathan Vegdahl 3d3149e0d5 Silence clippy warning. 3 years ago
Nathan Vegdahl e686c3e462 Merge branch 'master' of github.com:helix-editor/helix into line_ending_detection
Rebasing was making me manually fix conflicts on every commit, so
merging instead.
3 years ago
Nathan Vegdahl 4efd6713c5 Work on moving code over to LineEnding instead of assuming '\n'.
Also some general cleanup and some minor fixes along the way.
3 years ago
Nathan Vegdahl 5d22e3c4e5 Misc fixes and clean up of line ending detect code. 3 years ago
Blaž Hrastnik e9a3245aae Re-export unicode crates from helix_core 3 years ago
Blaž Hrastnik 9275021497 ui: prompt: Better unicode support
We copied over eval_movement from wezterm, that already solves most of
our problems. self.cursor is now byte-based.
3 years ago
Jan Hrastnik 8634e04a31 added the line_end helper function 3 years ago