Fix vim increment/decrement on Markdown list markers#47978
Fix vim increment/decrement on Markdown list markers#47978dinocosta merged 2 commits intozed-industries:mainfrom
Conversation
|
Hi @dinocosta, I'm so sorry about that, I am using these issues to help me learn about Zed's codebase as I have something of my own that I want to integrate into Zed :) I truly appreciate your patience and I promise I am taking notes and I will use your testing example to validate before I commit again. |
|
hey, my mistake - I was testing with the installed Zed app instead of building from the branch. It works fine with cargo run --release. also converted the test to use NeovimBackedTestContext so it validates against real neovim now. |
8f9eb3b to
7eea3f6
Compare
There was a problem hiding this comment.
Hi @dinocosta, I'm so sorry about that, I am using these issues to help me learn about Zed's codebase as I have something of my own that I want to integrate into Zed :)
I truly appreciate your patience and I promise I am taking notes and I will use your testing example to validate before I commit again.
No worries! In general, it’s better to only open Pull Requests once you’ve fully tested your changes and they’re ready to be reviewed. Otherwise a maintainer might spend time reviewing changes that weren’t meant to be reviewed yet. This helps us keep the review queue focused on things that are ready to land 🙂
I've taken a second look at the changes and, even though they seem to be working, they seem to be working only on a very specific case, only on the first element in the list and only if there's no text before it?
Here's a quick screen recording showing Neovim's (even though it doesn't have the filetype set to Markdown) next to the changes in this branch ▼
CleanShot.2026-02-03.at.10.39.45.mp4
I believe that we'd like for ctrl-a and ctrl-x to work on any of the list elements and in any scenario 🤔
|
Thank you again for the detailed follow up, I promise I DID build and test Zed :D but obviously I didn't check enough items, and I'll get a better fix up today. |
…mbers Two fixes for vim ctrl-a/ctrl-x: 1. Markdown list markers on non-first lines now work. When cursor is on "1" in "text\n1. item", the backward scan stopped at the newline but left the offset pointing at it, causing the forward scan to immediately break. Now we skip past the newline so the forward scan finds the number. 2. Negative numbers with cursor on the digit now work with trailing dots. For "-1." with cursor on "1", the dot handling now recognizes the cursor is within the number (not just at/before its start) and ends the match. Fixes zed-industries#47761 Co-Authored-By: Claude Opus 4.5 <[email protected]>
7eea3f6 to
046ea39
Compare
zed-vim-inc-dec.movThis seems to work better, open to suggestions |
`find_target()` failed to match numbers followed by a dot and a non-digit (e.g. `1. item`), because the dot unconditionally reset the scan state, discarding the number. Additionally, numbers at the start of non-first lines were missed because the backward scan stopped on the preceding newline and the forward scan immediately broke on it. Closes #47761 Release Notes: - Fixed vim increment (`ctrl-a`) and decrement (`ctrl-x`) not working on Markdown ordered list markers like `1.`, `2.`, etc. --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: dino <[email protected]>
Summary
Ctrl+A(increment) andCtrl+X(decrement) not working on Markdown ordered list markers like1.,2., etc.Root Cause
In
find_target(), when a.was encountered after a number, the search state was reset unconditionally. This caused1. textto skip the1and find nothing to increment.Fix
Modified the
.handling to terminate the match (instead of reset) when:This correctly handles both
1. text(increments1) and111..2(skips111, increments2).Test plan
test_increment_markdown_list_markerscovering increment, decrement, multi-digit markers, and count-based incrementCloses #47761
Release Notes:
ctrl-a) and decrement (ctrl-x) not working on Markdown ordered list markers like1.,2., etc.🤖 Generated with Claude Code