Open brokedarius opened 4 months ago
I can't reproduce this. Please provide your xonfig
as well as example.
I can't reproduce this. Please provide your
xonfig
as well as example.
Seems to be only affecting functions with tab indents not spaces after further testing so apologies for lumping them in.
For instance can you please try pasting this small example function in a xonsh shell if you don't mind?:
def save_toml(toml_dict: dict[str, str], toml_path: str) -> None:
with open(toml_path, 'w') as c:
c.write(tomlkit.dumps(asdict(toml_dict)))
Also I am on windows, tried it on both tabby and windows terminal where its very slow to finish pasting, sometimes it does not when the function is a bit bigger. On conhost it pastes rather fast but the tab indents are not respected either.
Can you confirm that pasting works as you expect when xonsh
isn't in the mix?
yes works fine from regular python console sorry I was away for a little while
I noticed something:
I opened the project in VSCode and realized that in ptk_shell/key_bindings.py if you change this function from this:
@Condition
def tab_insert_indent():
"""Check if <Tab> should insert indent instead of starting autocompletion.
Checks if there are only whitespaces before the cursor - if so indent
should be inserted, otherwise autocompletion.
"""
before_cursor = get_app().current_buffer.document.current_line_before_cursor
return bool(before_cursor.isspace())
to this:
@Condition
def tab_insert_indent():
"""Check if <Tab> should insert indent instead of starting autocompletion.
Checks if there are only whitespaces before the cursor - if so indent
should be inserted, otherwise autocompletion.
"""
before_cursor = get_app().current_buffer.document.current_line_before_cursor
return True
It somehow applies a 'wall patch' to my issue but obviously I lose the ability to tab complete which I don't care for personally but now at least we know that in this function the boolean is most likely always evaluating to False when pasting text because of this expression? get_app().current_buffer.document.current_line_before_cursor.isspace()
.
Either that or some interference due to the fact that the TAB key is reserved for other operations? Let me know.
(Only tested on Windows 10)
xonfig
Expected Behavior
When pasting text, it should take into account tab indents as well as spaces not only that but it should also do it much faster.
Current Behavior
When I paste functions and such, I have to wait several seconds/minutes for it to paste and only for it most of the time to not have it's tab indents/spaces taken into accounts. Kind of ironic for a python shell.
Steps to Reproduce
Copy pasting functions with tab indents or spaces as indents (spaces seem to have a bit less issues?)