Comments (8)
OK, it seems this is intended:
def get_reserved_space(self):
"""Get the number of lines to reserve for the completion menu."""
reserved_space_ratio = 0.45
max_reserved_space = 8
_, height = click.get_terminal_size()
return min(int(round(height * reserved_space_ratio)), max_reserved_space)
I'm still perplexed, because I see that upward pop-up menus are supported - they print upwards when inputting multi-line sql.
All in all, I think the suggestions pop-up menu has inconsistent behavior - something else I've found is that even if the supposed reserved space is 8 (yield 7 entries), when inputting a sql statement more than 8 lines long, the menu will show (upwards) up to 15 entries.
from litecli.
The upward pop-up menu is a desperate attempt to show the menu when the app is all out of options. It hinders the view of the statement you've entered so far and it is generally an unpleasant experience.
That's the reason why we reserve 7 lines at the bottom. Your point about showing 15 items is using a scroll mechanism in the pop-up menu itself. It's actually not limited to 15 items, it'll show as many items as we have for that context.
I understand that it feels like a waste of space at the bottom but given the various options we chose to go with the one with minimal impact.
from litecli.
The upward pop-up menu is a desperate attempt to show the menu when the app is all out of options. It hinders the view of the statement you've entered so far and it is generally an unpleasant experience.
That's the reason why we reserve 7 lines at the bottom. Your point about showing 15 items is using a scroll mechanism in the pop-up menu itself. It's actually not limited to 15 items, it'll show as many items as we have for that context.
I understand that it feels like a waste of space at the bottom but given the various options we chose to go with the one with minimal impact.
I see. In this case, two notes:
- I suspect we're not referring to the same thing regarding the
15
. This is what I refer to:
/path/to/myfile.sqlite3> a
a
a
ABORT
ACTION
ADD
AFTER
ALL
ALTER
ANALYZE
AND
AS
ASC
ATTACH
AUTOINCREMENT
BEFORE
BEGIN
BETWEEN
BIGINT
this is obtained by enabling multiline statements, and typing (a
-> Enter) 20 times. It's not very clear from the output, but that's a 16-lines (so I was wrong mentioning 15
) menu, from a much longer list of suggestions (after the last enter, LiteCLI opens the popup for a null prefix, yielding the list of all the potential SQL commands).
Is 16 (upwards) entries intended to be different from the 7 downwards?
- Would you consider a PR allowing the user to customize the number of entries? I think it would be helpful in general, as people may prefer different lengths.
from litecli.
- The 7 lines is the absolute minimum we reserve. If there is more space in the screen then I believe we will expand the menu to 16 lines. I'm not sure on the exact details.
- Regarding the config option. Take a quick look at this design philosophy: https://fishshell.com/docs/current/design.html
I am generally reluctant about adding a kitchen sink of options in the config file. But this is a new project and I would love to have more people participating in the code development. If you feel strongly about it, feel free to open a PR, I'll see what I can do. π
from litecli.
I am generally reluctant about adding a kitchen sink of options in the config file. But this is a new project and I would love to have more people participating in the code development.
Mostly, the amount of rows left blank is relatively high. On my machine, it's 7 rows on 57 - 12%.
The option to specify the number of rows may be too fine grained. What do you think of an option to entirely remove the suggestions menu? Autocompletion is still available even without those (it happens via "shadow" characters).
from litecli.
Aha. Now I know the reasoning behind your request. The real crux of the issue is that 7 lines might be enough for some people but it might be too much for someone else who has a small monitor or a lower resolution. So instead of hardcoding it to 7 how about we do something a bit more adaptive? I'm sure we can easily find the size of the terminal, how about we reserve 10% of that height for the menu and have a hard limit of 7 if the 10% ends up being greater than 7?
I want to highlight this passage from the fish design document:
Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it.
Let's see if we can do something smart instead of asking the user to choose. π
If you'd like to submit that as a PR, I'll be more than happy to merge it in.
from litecli.
I've just patched the code not to show anything, for my specific case is much more convenient.
Since the generic issue is moot (the space is intended), I think the issue can be closed, but thanks for the explanations!
from litecli.
π
from litecli.
Related Issues (20)
- use \033 in prompt HOT 5
- Add support for the `--wrap` and `--wordwrap` options from sqlite3
- Feature request for `.indexes` command support. HOT 2
- No such function: REGEXP
- Support `.eqp` like in sqlite3 HOT 3
- Can't use .once more than once. HOT 1
- When using .once -o, only last line remains HOT 2
- .schema: line breaks and missing index information
- βpython_requiresβ should be set with β>=3.6β, as litecli 1.9.0 is not compatible with all Python versions
- feature request: sqlite3.38+ support for json to use its new features HOT 1
- Test failure with sqlparse==0.4.3
- Header names vague or hidden in grid mode HOT 2
- when insert to `table t(t text)` , raise an exception
- When long wide characters are stored in the database, it will not output some rows if enabled auto_vertical_output HOT 1
- STRICT tables seem to not be supported HOT 1
- FR: configuration to import custom python functions
- Feature comparison with SQLite CLI special commands (dot commands) HOT 1
- FR: support environment variables in (favourite) queries
- Cancelling a query leads to an error message, there is no 'KILL' command in sqlite HOT 1
- syntax style changes output behaviour HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from litecli.