Curly Brace deletion behaving unexpectedly

Open
#264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript
Domain
tooling

Research direction

Reproduce the behavior in codemirror-vim using the provided C function, with the cursor on the function's first character; compare da} and da{ against regular Vim. Trace the brace-text-object handling and consider the issue done when da} deletes the outer function block as Vim does while da{ continues to work correctly.

Written by the indexing model from the issue text.

Description

struct Node *reverse_list(struct Node *head) {
    struct Node *prev = NULL;
    struct Node *current = head;
    struct Node *next = NULL;

    while (current != NULL) {
        next = current->next;
        current->next = prev;
        prev = current;
        current = next;
    }
    return prev;
}

If your cursor is on the first character of this function, and you run da}, it will delete the inner curly brace while loop. In regular vim, it would delete the outer. Note da { would work correctly.

Dominant language
JavaScript
Stars
470
Forks
53
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from replit/codemirror-vim

All issues in replit/codemirror-vim

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.