gedatsu217 added a comment.

>>> I don't think the value of m_previous_autosuggestion_size should only grow 
>>> (which is what this if is doing), as this way we just keep printing a 
>>> longer and longer space buffer over time. Just printing enough to clear the 
>>> buffer of the previous completion is enough.
>>
>> If I keep the number of characters of the only previous command, I think 
>> there is a problem. For example, If I type "help frame var" → "help frame 
>> info" → "help frame v", the remains are hidden. However, If I type "help 
>> frame var" → "help frame info" → "help" → "help frame v", the number of 
>> characters of "help frame var" is more than that of "help", so "help frame 
>> v[aro]" is displayed. What do you think?
>
> Not sure if I understand your example correctly, but as soon as you type 
> "help frame ", you should have an autosuggestion of "help frame info" and 
> then typing the "v" should clear the "nfo" part. The "help" autosuggestion 
> should not be involved at all in any logic after you typed "help "?

What I mean is that if I should keep the length of characters of the only 
previous command, following thing occurs.

1. execution "help frame var" and m_previous_autosuggestion_size = len("help 
frame var") = 14
2. execution "help frame info" and m_previous_autosuggestion_size = len("help 
frame info") = 15
3. execution "help" and m_previous_autosuggestion_size = len("help") = 4
4. Typing "help frame v". Then, spaces_to_print = 
m_previous_autosuggestion_size - line.size() - to_add.getValue().length() = 4 - 
12 - 2 < 0. So, spaces are not added. (In short, "help frame v[aro]" is 
displayed.)

(Maybe, I do not understand what you say. )

>>> Also you can just do this calculation directly after you calculated int 
>>> spaces_to_print above. This way this code is closer together which 
>>> hopefully makes this easier to understand.
>>
>> For example, if the user executes a command directly after using 
>> tab-completion, Editline::TypedCharacter is not called, so spaces_to_print 
>> is not calculated. That is because I can calculate this here.
>
> Can you give me an example input where this breaks? I'm not sure how the tab 
> completion would influence until what column we would need to overwrite the 
> line buffer (that should still be the same).

If m_previous_autosuggestion_size is calculated in Editline::TypedCharacter,

1. Execution "help frame info", m_previous_autosuggestion_size = len("help 
frame info") = 15
2. Typing "help frame va" and pressing tab-key. "help frame variable" is 
executed. m_previous_autosuggestion_size = len("help frame va") = 13. (because 
m_previous_autosuggestion_size is not calculated in Editline::TabCommand.)
3. Typing "help frame i". Then, spaces_to_print = 
m_previous_autosuggestion_size - line.size() - to_add.getValue().length() = 13 
- 12 - 3 < 0. So, spaces are not added. "help frame i[nfoable] is displayed.

> Did you try if your previous code fixes this issue?

Not yet. I will try it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to