6fbc85e168
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.
|
5 months ago | |
---|---|---|
.cargo | 10 months ago | |
.github | 6 months ago | |
book | 5 months ago | |
contrib | 8 months ago | |
docs | 12 months ago | |
helix-core | 5 months ago | |
helix-dap | 5 months ago | |
helix-event | 7 months ago | |
helix-loader | 6 months ago | |
helix-lsp | 5 months ago | |
helix-parsec | 12 months ago | |
helix-stdx | 5 months ago | |
helix-term | 5 months ago | |
helix-tui | 5 months ago | |
helix-vcs | 6 months ago | |
helix-view | 5 months ago | |
runtime | 5 months ago | |
xtask | 8 months ago | |
.envrc | 1 year ago | |
.gitattributes | 2 years ago | |
.gitignore | 2 years ago | |
CHANGELOG.md | 8 months ago | |
Cargo.lock | 5 months ago | |
Cargo.toml | 5 months ago | |
LICENSE | 4 years ago | |
README.md | 11 months ago | |
base16_theme.toml | 5 months ago | |
default.nix | 7 months ago | |
flake.lock | 9 months ago | |
flake.nix | 6 months ago | |
grammars.nix | 11 months ago | |
languages.toml | 5 months ago | |
logo.svg | 11 months ago | |
logo_dark.svg | 11 months ago | |
logo_light.svg | 11 months ago | |
rust-toolchain.toml | 7 months ago | |
rustfmt.toml | 3 years ago | |
screenshot.png | 3 years ago | |
shell.nix | 2 years ago | |
theme.toml | 7 months ago |
README.md
A Kakoune / Neovim inspired editor, written in Rust.
The editing model is very heavily based on Kakoune; during development I found myself agreeing with most of Kakoune's design decisions.
For more information, see the website or documentation.
All shortcuts/keymaps can be found in the documentation on the website.
Features
- Vim-like modal editing
- Multiple selections
- Built-in language server support
- Smart, incremental syntax highlighting and code editing via tree-sitter
It's a terminal-based editor first, but I'd like to explore a custom renderer (similar to Emacs) in wgpu or skulpin.
Note: Only certain languages have indentation definitions at the moment. Check
runtime/queries/<lang>/
for indents.scm
.
Installation
Contributing
Contributing guidelines can be found here.
Getting help
Your question might already be answered on the FAQ.
Discuss the project on the community Matrix Space (make sure to join #helix-editor:matrix.org
if you're on a client that doesn't support Matrix Spaces yet).
Credits
Thanks to @jakenvac for designing the logo!