zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.42k stars 1.16k forks source link

Filetypes duplicates when you set filetype #3186

Open dustdfg opened 3 months ago

dustdfg commented 3 months ago

Description of the problem or steps to reproduce

TL;DR it is not a problem of the filetype but almost about reloading and solvable by #3062

When I use set filetype <filetype> the auto-completion duplicate names

  1. Open micro
  2. Write set filetype
  3. Press tab
  4. Press enter
  5. Write again set filetype
  6. Press tab again

screen-1710697530

Roots of the problem

Firstly I thought problem in https://github.com/zyedidia/micro/blob/5ae2799b7044f625012dbde916091f81a01b383a/internal/action/infocomplete.go#L62-L96 But then I realized that code for color schemes auto-completion is the same as for filetype auto-completion. https://github.com/zyedidia/micro/blob/5ae2799b7044f625012dbde916091f81a01b383a/internal/action/infocomplete.go#L190-L194 They even used both in the same way so the problem not in the action/infocomplete.go

The problem is somewhere inside the buffer.SetOption function which tries to make reload

https://github.com/zyedidia/micro/blob/5ae2799b7044f625012dbde916091f81a01b383a/internal/buffer/settings.go#L22-L33

Specifications

Version: 2.0.14-dev.77 Commit hash: 5ae2799b OS: debian 12/testing Terminal: foot

dustdfg commented 3 months ago

One more reason to test that PR :)