VSCodeVim / VSCodeVim/Vim

`gq` is inconsistent when reflowing multiple lines at once

Open
#6,605 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
gq does not reflow properly when trying to reflow mulitple lines at once

To Reproduce
Steps to reproduce the behavior:

  1. Paste in the following lines with linebreaks:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ante nibh, molestie et accumsan 
rhoncus, interdum vel urna. Nullam lacus ipsum, rhoncus
sagittis dapibus id, imperdiet eget ex. Nullam sagittis justo in nunc ultricies sodales. Proin id enim massa. Duis sagittis lacus erat, id molestie tellus
volutpat eu. Ut quis tincidunt justo,
in dictum ex. Aliquam 
in lectus at dui
aliquet auctor ac a lorem. Curabitur eget consectetur dolor. 
  1. Select all lines (for example vip) and then gq.
  2. Observe that the reflowing is very inconsistent.

Expected behavior
I expect it to look as the first after section in the image below, but rather it is very inconsistent in its
line widths.

Screenshots

The first before/after set is what I expect, the latter is the exact same words, but with some added line breaks.

image

Environment

  • Extension (VsCodeVim) version: 1.20.2
  • VSCode version: 1.56
  • OS: (K)Ubuntu 20.04, Windows 10 Home

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the issue in VSCodeVim with the supplied text, selecting all lines and running gq. Compare the result with the expected first “after” example in the linked screenshot. Done means reflowing the same words produces consistent line widths regardless of the original line breaks.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.