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

More sensible and legible autocomplete order #2182

Open
reagle opened this issue Dec 20, 2023 · 2 comments
Open

More sensible and legible autocomplete order #2182

reagle opened this issue Dec 20, 2023 · 2 comments
Labels

Comments

@reagle
Copy link
Contributor

reagle commented Dec 20, 2023

Following a thought in a related issue, when I'm at the expression prompt and I hit tab to autocomplete the column name, it presents them in an odd order that I can't identify. It's not left to right. It'd be nice if it started with current column then it could move: leftward, rightward, or back to 0 then rightward.

@midichef
Copy link
Contributor

The column names are in alphabetical order (and case sensitive).

The line that determines this is:

varnames.extend(sorted((base+col.name) for col in self.sheet.columns if col.name.startswith(partial)))

Or to start at the column right of the current column, going rightward and wrapping around back the leftmost:

import itertools   #at the top of expr.py

#...

pivot = self.sheet.cursorColIndex
cols = [self.sheet.columns[i] for i in itertools.chain(range(pivot+1, len(self.sheet.columns)), range(0, pivot+1))]
varnames.extend((base+col.name) for col in cols if col.name.startswith(partial))

To instead start at the leftmost column, change it to:

varnames.extend((base+col.name) for col in self.sheet.columns if col.name.startswith(partial))

Personally, I find alphabetical order intuitive, since that's what shell completions often use.

@reagle
Copy link
Contributor Author

reagle commented Mar 12, 2024

@midichef, thanks for the clarification. I was so dead set of thinking about column order I hadn't appreciated some might like alphabetical. I'd be curious what others prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants