aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests
Commit message (Collapse)AuthorAge
* Follow parent links when calculating changes since a revisionMichael Davis2022-11-24
| | | | | | The 'revisions' field on History can't be treated as linear: each Revision in the revisions Vec has a parent link and an optional child link. We can follow those to unroll the recent history.
* Apply inversions to Views on undo/redoMichael Davis2022-11-24
| | | | | | | | When using undo/redo, the history revision can be decremented. In that case we should apply the inversions since the given revision in History::changes_since. This prevents panics with jumplist operations when a session uses undo/redo to move the jumplist selection outside of the document.
* Add test case that panics on undoMichael Davis2022-11-24
| | | | | | | This case panics since undo/redo call View::apply and here, the edit that moves the jumplist selection out-of-bounds is not yet applied when View::apply is called in undo/redo. View::apply should only be called by the EditorView now.
* Apply transactions to all views (#4733)Michael Davis2022-11-23
| | | | | | | | | | | | | | | | | * Add a test case for updating jumplists across windows * Apply transactions to all views on history changes This ensures that jumplist selections follow changes in documents, even when there are multiple views (for example a split where both windows edit the same document). * Leave TODOs for cleaning up View::apply * Use Iterator::reduce to compose history transactions Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Fix range offsets for multiple shell insertions (#4619)Michael Davis2022-11-14
| | | | | | | | | | | | | d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression for shell commands like `|`, `!`, and `<A-!>` which caused the new selections to be incorrect. This caused a panic when piping (`|`) would cause the new range to extend past the document end. The paste version of this bug was fixed in 48a3965ab43718ce2a49724cbcc294b04c328b81. This change also inherits the direction of the new range from the old range and adds integration tests to ensure that the behavior isn't broken in the future.
* Fix range offsets in multi-selection paste (#4608)Michael Davis2022-11-06
| | | | | | | | | | | | | * Fix range offsets in multi-selection paste d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression with multi-selection paste where pasting would not adjust the ranges correctly. To fix it, we need to track the total number of characters inserted in each changed selection and use that offset to slide each new range forwards. * Inherit selection directions on paste * Add an integration-test for multi-selection pasting
* Trim quotes and braces from paths in goto_file_impl (#4370)Dario Oddenino2022-10-28
| | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* flush writes on force quit (#4397)Skyler Hawthorne2022-10-21
| | | | | | When force quitting, we need to block on the pending writes to ensure that write commands succeed before exiting, and also to avoid a crash when all the views are gone before the auto format call returns from the LS.
* Fix multi byte auto pairs (#4024)Skyler Hawthorne2022-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix test::print for Unicode The print function was not generating correct translations when the input has Unicode (non-ASCII) in it. This is due to its use of String::len, which gives the length in bytes, not chars. * Fix multi-code point auto pairs The current code for auto pairs is counting offsets by summing the length of the open and closing chars with char::len_utf8. Unfortunately, this gives back bytes, and the offset needs to be in chars. Additionally, it was discovered that there was a preexisting bug where the selection was not computed correctly in the case that the cursor was: 1. a single grapheme in width 2. this grapheme was more than one char 3. the direction of the cursor is backwards 4. a secondary range In this case, the offset was not being added into the anchor. This was fixed. * migrate auto pairs tests to integration * review comments
* Silence dead_code warning on AppBuilder::with_configMichael Davis2022-10-20
| | | | | This function is not currently used but is likely to be useful in the future, so this change silences the dead_code warning.
* Remove language-server configuration in integration testsMichael Davis2022-10-20
| | | | | | | | | | | | | | | | | | | | | This change removes language server configuration from the default languages.toml config for integration tests. No integration-tests currently depend on the availability of a language server but if any future test needs to, it may provide a language server configuration by passing an override into the `test_syntax_conf` helper. Language-servers in integration tests cause false-positive failures when running integration tests in GitHub Actions CI. The Windows runner appears to have `clangd` installed and all OS runners have the `R` binary installed but not the `R` language server package. If a test file created by `tempfile::NamedTempFile` happens to have a file extension of `r`, the test will most likely fail because the R language server will fail to start and will become a broken pipe, meaning that it will fail to shutdown within the timeout, causing a false-positive failure. This happens surprisingly often in practice. Language servers (especially rust-analyzer) also emit unnecessary log output when initializing, which this change silences.
* Use helix_view::apply_transaction in integration-testsMichael Davis2022-10-20
| | | | | | | `helix_view::apply_transaction` closes over `Document::apply` and `View::apply` to ensure that jumplist entries are updated when a document changes from a transaction. `Document::apply` shouldn't be called directly - this helper function should be used instead.
* improve app close failure displaySkyler Hawthorne2022-10-19
|
* fix testsSkyler Hawthorne2022-10-19
|
* document should save even if formatter failsSkyler Hawthorne2022-10-19
|
* fix write scratch buffer to fileSkyler Hawthorne2022-10-19
|
* various fixes in write-all pathSkyler Hawthorne2022-10-19
|
* update write-quit to wait for savesSkyler Hawthorne2022-10-19
|
* fix buffer-closeSkyler Hawthorne2022-10-19
|
* fix(write): do not set new path on document until write succeedsSkyler Hawthorne2022-10-19
| | | | | | If a document is written with a new path, currently, in the event that the write fails, the document still gets its path changed. This fixes it so that the path is not updated unless the write succeeds.
* fix: buffer-close ensuring writesSkyler Hawthorne2022-10-19
| | | | Make sure buffer-close waits for the document to finish its writes.
* chore(write): serialize write operations within a DocumentSkyler Hawthorne2022-10-19
| | | | | | | | | | | | | | | The way that document writes are handled are by submitting them to the async job pool, which are all executed opportunistically out of order. It was discovered that this can lead to write inconsistencies when there are multiple writes to the same file in quick succession. This seeks to fix this problem by removing document writes from the general pool of jobs and into its own specialized event. Now when a user submits a write with one of the write commands, a request is simply queued up in a new mpsc channel that each Document makes to handle its own writes. This way, if multiple writes are submitted on the same document, they are executed in order, while still allowing concurrent writes for different documents.
* Fix append cursor location when selection anchor is at end of document (#4147)Graic2022-10-12
|
* Add tests for select-mode TS textobjectsMichael Davis2022-10-03
|
* fix: Recalculate completion when going through prompt history (#3193)Frojdholm2022-08-31
| | | | | | | | | | | | | | | | | | | | | | | | * fix: Recalculate completion when going through prompt history * Update completion when the prompt line is changed It should not be possible to update the line without also updating the completion since the completion holds an index into the line. * Fix Prompt::with_line recalculate completion with_line was the last function where recalculate completion had to be done manually. This function now also recalculates the completion so that it's impossible to forget. * Exit selection when recalculating completion Keeping the selection index when the completion has been recalculated doesn't make sense. This clears the selection automatically, removing most needs to manually clear it. * Remove &mut on save_filter Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Fix backwards selection duplication widening bug (#2945)A-Walrus2022-07-04
| | | | | | | | | | | | | * Fix backwards selection duplication widening bug * Add integration tests * Make tests line-ending agnostic Make tests line-ending agnostic Use indoc to fix tests Fix line-ending on test input
* replace phrase in testsSkyler Hawthorne2022-06-19
|
* factor new Application with file arg to functionSkyler Hawthorne2022-06-19
|
* fix(command): write-quit: do not quit if write failsSkyler Hawthorne2022-06-19
| | | | | | | | | During write-quit, if the file fails to be written for any reason, helix will still quit without saving the changes. This fixes this behavior by introducing fallibility to the asynchronous job queues. This will also benefit all contexts which may depend on these job queues. Fixes #1575
* add test for write-quit happy pathSkyler Hawthorne2022-06-19
|
* rename test helpersSkyler Hawthorne2022-06-19
|
* ignore failing write path tests until fixes are mergedSkyler Hawthorne2022-06-19
|
* rename top level module to satisfy cargo fmtSkyler Hawthorne2022-06-19
|
* use a read only file to ensure write failureSkyler Hawthorne2022-06-19
|
* use system's appropriate line endingSkyler Hawthorne2022-06-19
|
* use Results in integration tests for more error contextSkyler Hawthorne2022-06-19
|
* use idle timer instead of fixed timeoutSkyler Hawthorne2022-06-19
|
* tests for buffer-closeSkyler Hawthorne2022-06-19
|
* tests for serialized writesSkyler Hawthorne2022-06-19
|
* use main application event loopSkyler Hawthorne2022-06-19
| | | | Use the Application's main event loop to allow LSP, file writes, etc
* add test for ensuring the initial cursor on a newly opened fileSkyler Hawthorne2022-06-19
|
* reorganize tests into groupsSkyler Hawthorne2022-06-19
|
* refactor helpers, use new test helpersSkyler Hawthorne2022-06-19
|
* Fix initial selection of Document in new viewSkyler Hawthorne2022-06-19
| | | | | | | | | | | When a new View of a Document is created, a default cursor of 0, 0 is created, and it does not get normalized to a single width cursor until at least one movement of the cursor happens. This appears to have no practical negative effect that I could find, but it makes tests difficult to work with, since the initial selection is not what you expect it to be. This changes the initial selection of a new View to be the width of the first grapheme in the text.
* improve test harnessSkyler Hawthorne2022-06-19
| | | | | | | * Use new macro syntax for encoding sequences of keys * Make convenience helpers for common test pattern * Use indoc for inline indented raw strings * Add feature flag for integration testing to disable rendering
* Integration testing harnessBlaž Hrastnik2022-06-19