Skip to content

Fix completion when user already typed part of suggestion#42

Closed
klew wants to merge 0 commit intoExafunction:mainfrom
klew:main
Closed

Fix completion when user already typed part of suggestion#42
klew wants to merge 0 commit intoExafunction:mainfrom
klew:main

Conversation

@klew
Copy link
Copy Markdown
Contributor

@klew klew commented Jan 26, 2023

strpart function takes "length" as a third parameter. Previous implmentation was using index.

@pqn
Copy link
Copy Markdown
Contributor

pqn commented Jan 26, 2023

@klew do you happen to have an example completion where this was being buggy for me to test?

@klew
Copy link
Copy Markdown
Contributor Author

klew commented Jan 27, 2023

@pqn I had some troubles in understandnig when this part of code should execute. For sure current code is not correct, because this method expects length as third parameter and, based on context, you wanted to get part of string between two indexes (between two columns).

One simple example where current code (with "cursor_col - 1") gives wrong behavior (set ft=cpp) :


int main(#)

"#" is a cursor. It is important to provide empty line above, because otherwise there are no suggestions.
With "cursor_col - 1" it gets ~10 suggestions, but it failes to compare str part and ClearCompletion is called, so nothing is displayed (for majority of suggestions). After change to "cursor_col - col" it works better and display all suggestions with following closing bracket included.

image

@pqn
Copy link
Copy Markdown
Contributor

pqn commented Jan 27, 2023

Ah I see the problem. I'll try to push a fix for this soon.

@pqn
Copy link
Copy Markdown
Contributor

pqn commented Jan 28, 2023

I think #44 has likely resolved your issues, feel free to check.

@klew
Copy link
Copy Markdown
Contributor Author

klew commented Jan 28, 2023

It fixed that problem I shown in previous comment, however now it seems to interfere too much when I type or use backspace.

During typing, it enters chars at the end of line, then redraw it correctly.
During using backspace, it puts remaining part of suggestion to the next line and everything below just "jumps".

Here is short video showing this behavior:

Screencast.2023-01-28.22.55.35.mp4

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