This commit enhances the `yank-join` command by incorporating the
`unescape` function to process the separator provided by the user. This
improvement ensures that any escape sequences in the separator are correctly
interpreted, aligning with user expectations.
Previously, the `yank-join` command joined the current selection with the
separator as-is. With this update, escape sequences in the separator such as:
- `\\n` for newlines
- `\\t` for tabs
- `\\u{...}` for Unicode characters
are unescaped to their corresponding literal characters before joining the
selection.
This commit introduces a `str` module and an `unescape` function to
`helix-stdx`, which processes escape sequences in strings and converts
them into their corresponding literal characters. The function handles a
variety of escape sequences, including:
- `\n` for newlines
- `\t` for tabs
- `\u{...}` for Unicode characters
The function does not unescape sequences like `\\` to `\`, leaving them
as they are. This opinionated behavior ensures that only certain escape
sequences are processed, and is built around user input, not general
input.
Given that its based around user input, a conservative approach was
taken for handling bad input, where if the string cannot be processed as
expected, it returns the original input.
Examples:
- Converting escaped newlines: `unescape("hello\\nworld")` results in
`"hello\nworld"`.
- Converting escaped tabs: `unescape("hello\\tworld")` results in
`"hello\tworld"`.
- Converting Unicode escape sequences:
`unescape("hello\\u{1f929}world")` results in `"hello🤩world"`.
- Handling invalid Unicode escape sequence:
`unescape("hello\\u{999999999}world")` results in the original
`"hello\\u{999999999}world"`.
The implementation also includes tests, but no gaurantees for edgecases.
* base16_default: add `ui.statusline` for `color-modes`
Signed-off-by: J. Dekker <jdek@itanimul.li>
* base16_default: add `ui.virtual` default
Previously virtual text such as LSP inlay was impossible to distinguish
from 'real' text by default.
Signed-off-by: J. Dekker <jdek@itanimul.li>
---------
Signed-off-by: J. Dekker <jdek@itanimul.li>
When parsing injections, we skip adding a new layer if there is an
existing layer covering the same range. When doing so we did not update
the parent layer ID, so some layers could have `parent` layer IDs that
pointed to a layer that no longer existed in the `layers` HopSlotMap
which could cause a panic when using `A-o`.
To fix this we update the `parent` pointer for both newly created
injection layers and reused ones.
* Implement check before adding path to files
* fix problem where directories were removed from args.files
* Revert "Implement check before adding path to files"
This reverts commit c123944d9b.
* Dissallow opening of irregular non-symlink files
* Fixed issue with creating new file from command line
* Fixed linting error.
* Optimized regularity check as suggested in review
* Created DocumentOpenError Sum Type to switch on in Application
* Forgot cargo fmt
* Update helix-term/src/application.rs
Accept suggestion in review.
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Moved thiserror version configuration to the workspace instead of the individual packages.
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix multiple broken links in the documentation
* Apply code review suggestion
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix jump_backwards behaviour when jumplist is at capacity
* Decrement self.current while popping from front
* Fix issue with conflicting updates to self.current
* Realised that truncate is intentional
* Use saturating_sub when decrementing current
* Fix naming of previous jump, and remove unneeded comment change
* Remove unnecessary changes in push
* Return num elements removed from front, and use in backward method
* Hide num_removed from public interface and tidy up jump location check
unicode-width 0.1.13 contains some fixes that change the widths of line
endings, which breaks some assumptions in helix-tui, causing some
rendering artifacts. We can downgrade to remove the rendering errors
for now.
* auto save after delay
* configable
* clearer names
* init
* working with some odd behaviour
* working with greater consistency
* Apply reviewer suggestions
- Remove unneccessary field
- Remove blocking save
* Improve auto-save configuration
Auto save can be configured to trigger on focus loss:
```toml
auto-save.focus-lost = true|false
```
and after a time delay (in milli seconds) since last keypress:
```toml
auto-save.after-delay.enable = true|false
auto-save.after-delay.timeout = [0, u64::MAX] # default: 3000
```
* Remove boilerplate and unnecessary types
* Remove more useless types
* Update docs for auto-save.after-delay
* Fix wording of (doc) comments relating to auto-save
* book: Move auto-save descriptions to separate section
---------
Co-authored-by: Miguel Perez <miguelvojito@gmail.com>
Co-authored-by: Miguel Perez <perezoji@cs.fsu.edu>
* Remove special-casing of line ending characters in selection replacement
* Refactor line ending handling and integration test to address code review comments
This is useful for resetting multiple changes at once. For example you
might use 'maf' or even '%' to select a larger region and reset all
changes within.
The original behavior of resetting the change on the current line is
retained when the primary selection is 1-width since we look for chunks
in the line range of each selection.