Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve insexpand.c traversal readability #16600

Closed
wants to merge 1 commit into from

Conversation

glepnir
Copy link
Member

@glepnir glepnir commented Feb 9, 2025

Problem:

  • Complex while loops with nested conditions
  • Redundant if branches
  • Hard to understand and maintain

Solution:

  • Restructure using while(true) with clear break conditions
  • Using ternary replace some if usages
  • Add descriptive comments for each step

Problem:
- Complex while loops with nested conditions
- Redundant if branches
- Hard to understand and maintain

Solution:
- Restructure using while(true) with clear break conditions
- Using ternary replace some if usages
- Add descriptive comments for each step
@chrisbra chrisbra closed this in 40891ba Feb 10, 2025
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Feb 11, 2025
Problem:  insexpand.c hard to read
Solution: refactor slightly to make it better readable
          (glepnir)

Problem:
- Complex while loops with nested conditions
- Redundant if branches
- Hard to understand and maintain

Solution:
- Restructure using while(true) with clear break conditions
- Using ternary to replace some if conditions
- Add descriptive comments for each step

closes: vim/vim#16600

vim/vim@40891ba

Co-authored-by: glepnir <glephunter@gmail.com>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Feb 11, 2025
Problem:  insexpand.c hard to read
Solution: refactor slightly to make it better readable
          (glepnir)

Problem:
- Complex while loops with nested conditions
- Redundant if branches
- Hard to understand and maintain

Solution:
- Restructure using while(true) with clear break conditions
- Using ternary to replace some if conditions
- Add descriptive comments for each step

closes: vim/vim#16600

vim/vim@40891ba

Co-authored-by: glepnir <glephunter@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants