The map/noremap/unmap functions should only affect Normal, Visual, Select,
and Operator-pending modes (nvo), not all modes including Insert and
Command-line. This matches Vim's behavior where :map affects nvo modes only.
Changed from MappingMode.ALL to MappingMode.NVO.
Group mapping functions by mode instead of by operation type for better
organization and readability. Each mode group now contains:
- Recursive mapping (map variants)
- Non-recursive mapping (noremap variants)
- Unmap function
Order: map, nmap, vmap, xmap, smap, omap, imap, cmap
This makes the API more discoverable and easier to navigate.
The 3-argument mapping functions (e.g., nmap(keys, actionName, action)) had
incorrect implementation that used recursive mappings for both sub-mappings.
Also, this approach makes it impossible to implement other mapping features
such as skipping mapping registration if the mapping is already defined in
.ideavimrc.
A different solution for convenient mapping patterns will be implemented later.
Changes:
- Remove 16 three-argument function declarations from MappingScope interface
- Remove 16 three-argument function implementations from MappingScopeImpl
- Update ReplaceWithRegister plugins to use correct 2-step pattern:
1. nnoremap("<Plug>...") for non-recursive <Plug> → action
2. nmap("key", "<Plug>...") for recursive key → <Plug>
Total: 374 lines deleted, 18 lines added
The project switching and version control menus in the top-left corner remain unavailable due to accessibility issues (failure to implement the Accessible interface, specifically) with the ToolbarComboButton component in the IntelliJ platform.
Fixes wrong recorded inputs when code completion introduces an import.
Fixes wrong recorded inputs when completing a static member with a partial type name. Example: `WiE.A` -> `WindowEvent.ACTION_EVENT_MASK`
Co-authored-by: Alex Plãte <aleksei.plate@jetbrains.com>
Replace unsafe non-null assertions (!!) with explicit null checks that provide
meaningful error messages when fold regions are not found. This makes test
failures easier to debug by clearly indicating what was expected.
Changes:
- ChangeActionJavaTest: Fixed 4 instances in testInsertAfterToggleFold and testInsertBeforeFold
- VisualInsertActionJavaTest: Fixed 1 instance in test block insert after folds
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove duplicate empty dictionary test (already covered at line 28)
- Rename 'test len with zero' to 'test len with zero number' for clarity
- Rename 'test len with negative number' to 'test len with negative numbers' (plural)
Co-authored-by: Alex Plãte <AlexPl292@users.noreply.github.com>
What was inspected:
- LenFunctionTest.kt and its corresponding implementation LenFunctionHandler.kt
Issues found:
- Test coverage was limited to basic happy path scenarios
- Missing tests for important edge cases: empty strings, zero, negative numbers,
large numbers, empty collections, and special character handling
- No tests distinguishing between single-quoted and double-quoted string behavior
in Vimscript
Changes made:
- Added 9 new test methods covering:
* Empty strings (both single and double quoted)
* Empty lists and dictionaries
* Zero and negative numbers
* Large numbers
* Multi-element collections
* Strings with escape sequences (documenting Vim's single vs double quote behavior)
Why this improves the code:
- Ensures len() function handles all data type edge cases correctly
- Documents expected behavior for Vimscript string quoting conventions
- Provides regression protection against future changes
- Aligns with testing best practices by covering boundary conditions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Adds a test to verify that when using 'idearefactormode=visual' with
inclusive selection (default), the caret is correctly positioned at the
inclusive end of the selection (on the last character) rather than the
exclusive end (after the last character).
This test covers the caret adjustment logic in IdeaSpecifics.kt that
moves the caret from IntelliJ's exclusive end position to Vim's
inclusive end position for Visual mode when 'selection' doesn't contain
"exclusive".
Adds length validation before accessing string indices and replaces unsafe
!! operator with proper null handling to prevent crashes on invalid mapleader values.
The 'idearefactormode' default of Select would leave an inline rename in Insert mode, and hitting Escape to return to Normal frequently cancelled the rename.
Also fixes various edge cases when moving between template variables. Often, this works due to a change in selection, but if there's an empty template variable and no current selection, there's no change in selection, and the mode isn't updated.
In clearStatusBarMessage(), the mutable 'message' property was being
accessed multiple times without capturing it in a local variable. This
could theoretically cause issues if the property changed between the
null check and the usage. Additionally, calling toString() on a String
is redundant and creates an unnecessary allocation.
Fixed by capturing the message in a local variable at the start of the
method, which allows Kotlin's smart cast to work properly and removes
the need for the redundant toString() call.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added bounds checking to EndOfLineMatcher and StartOfLineMatcher to
prevent potential IndexOutOfBoundsException when index is outside the
valid text range. This follows the defensive programming pattern used
in other matchers like CharacterMatcher, DotMatcher, StartOfWordMatcher,
and EndOfWordMatcher.
Changes:
- EndOfLineMatcher: Added check for index > length before array access
- StartOfLineMatcher: Added check for index < 0 or index > length
While the NFA engine should prevent invalid indices, these defensive
checks improve code safety and consistency across all matcher
implementations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added a new bullet point under the Testing section that instructs
maintainers to write regression tests when fixing bugs. These tests
should:
- Fail with the buggy implementation
- Pass with the fix
- Document what bug they're testing
- Test the specific boundary condition that exposed the bug
This ensures bugs don't resurface during future refactorings and
provides clear documentation of the expected behavior.
Co-authored-by: Alex Plãte <AlexPl292@users.noreply.github.com>
This test validates the off-by-one error fix in IndexedExpression.kt:56.
When accessing a string at index equal to its length, the code should
return an empty string rather than throwing IndexOutOfBoundsException.
The old condition (idx > text.length) would allow idx == text.length to
pass through, causing an exception. The new condition (idx >= text.length)
correctly treats this as out of bounds.
Test case: 'hello'[5] should return '' since 'hello'.length == 5
Co-authored-by: Alex Plãte <AlexPl292@users.noreply.github.com>
Fixed three issues in IndexedExpression.kt:
1. Off-by-one error: Changed condition from `idx > text.length` to `idx >= text.length` to properly handle boundary cases when indexing strings
2. Redundant evaluation: Reused `indexValue` instead of re-evaluating `index.evaluate()` in the string indexing path
3. Variable shadowing: Renamed local variable from `index` to `indexNum` in `assignToListItem` to avoid shadowing the property
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed a variable shadowing bug in the hint generation logic where the lambda
parameter name 'it' was being shadowed in nested lambda, causing incorrect
logic when checking for hint conflicts. The code now uses explicit parameter
names 'candidateHint' and 'existingHint' to make the logic clear and correct.
Also replaced wildcard import (java.util.*) with explicit import of
WeakHashMap, following project conventions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed a missing assertion in the test case "test range negative with start
past end throws error" that was not verifying the error condition actually
occurred. Also cleaned up imports by adding a proper import for assertTrue
instead of using the fully qualified kotlin.test.assertTrue.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add bounds checking to clamp line numbers to the last line of the document,
preventing potential exceptions when accessing line text with out-of-bounds
ranges like `:$+100=`. This matches the behavior of other commands like
GoToLineCommand.
Also add tests to verify the edge case behavior with and without flags.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update copyright year from 2023 to 2025
- Remove redundant 'internal constructor()' modifier (already implied by internal class)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Expand the architecture reference to include more details about what contributors can find in CONTRIBUTING.md: architecture overview, testing guidelines, patterns, and awards program information.
Add comprehensive corner case categories for testing Vim commands including position-based, content-based, selection-based, motion-based, buffer state, and boundary conditions to help contributors write more thorough tests.
Update copyright year to 2025 and add test coverage for edge case when
caret is at the beginning of the command line.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>