* Make each paste its own undo step.
* Add a `Paste` input type, allowing us to...
* Fill the internal clipboard with bracketed paste contents.
* Abstract away clipboard handling into its own struct, so we can move
the cut/copy/paste logic into `TextBuffer`, allowing us to...
* Implement smart line-wise copy/paste via Ctrl+C/Ctrl+V.
Closes#286Closes#305
As per James Holderness' suggestion, we actually don't
need ESC timeouts here. In this phase of the app, escape
chars are very unlikely to be from keyboard input.
The previous `memchr` loop had the fatal flaw that it would break out
of the SIMD routines every time it hit a newline. This resulted in a
throughput drop down to ~250MB/s on my system in the worst case.
By writing SIMD routines specific to newline seeking, we can bump
that up by >500x. Navigating through a 1GB of text now takes ~16ms
independent of the contents.
`DisplayablePathBuf::from_string` allocates two heap memories for
`PathBuf` and `Cow::Owned`. However, it can be stored as `Cow::Borrowed`
because `String` guarantees UTF-8 sequence. This can remove one
redundant heap allocation.
This code was originally written for speeding up line searches but was disabled since we've since optimized line seeking with SIMD. We'll still have use for this code in the future, however, to cache syntax highlighter state every N lines.
Also includes:
* criterion update to v0.6
* Simplify range parameter for `GapBuffer::extract_raw`
* Allow deleting multiple units via `TextBuffer::delete`
* And some additional smaller improvements
This PR fixes the issue twice for double the fun: It now explicitly
checks for a non-empty needle and also ensures the selection is
non-empty which ensures `if !self.has_selection()` works correctly.
Closes#273
This may be a controversial opinion.
It felt weird to open edit, open a file, and then see "FILE + 1". I
didn't care about the empty Untitled document, and there was no reason
for it to be kept around.
After this pull request, if you launch edit and then Open a new document
without editing the existing placeholder untitled document or giving it
a name, Edit will close that document and open the new one.
The same applies to New: if you press New, and then Open, Edit will
close the untitled temporary document.