You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often when executing queries I'll need to revisit and tweak/correct a previous query that I've executed. In usql the up arrow walks back through the query history one line at a time rather than a query at a time.
This is awkward as I have to press up multiple times just to get the same query, made all the more difficult by the fact that the first line I add gets added back to the end of the history which adds an extra click. So in this example below I have to click up 25 times just to edit one line of this fairly small query.
usql:
psql on the other jumps back to the complete previous command with 1 up click and I can then navigate and update the query however I want and re-execute it very quickly.
psql:
It would be great if usql could be updated to match this behaviour as it would be a big boost in productivity with the tool.
How I would suggest it works is:
Only write to history on completion of a query, i.e. a semi-colon has been entered. This includes incomplete/syntactically incorrect queries ending in a semi-colon e.g. select foo from; as the user would likely want to just jump back and correct it without re-typing everything (psql also does this). This prevents the issue where the line selected keeps getting appended back onto the history before we've even executed it.
Then return a complete query at a time when navigating through the history. Using the logic above the history file is just a semi-colon delimited list of these queries so should be fairly simple to differentiate these.
The text was updated successfully, but these errors were encountered:
@jpy-git I too have issues with this, but I have not yet had the time to write a full/proper implementation of a readline prompt, and usql has been hindered from day one based on what's available. I'd like to get it done, but the issue is that a proper readline implementation that supports the functionality usql needs that overcomes this limitation, and, eg, would be compatible with libinput or some such, easily carries a scope 2 to 3 times as large as usql itself.
Often when executing queries I'll need to revisit and tweak/correct a previous query that I've executed. In usql the up arrow walks back through the query history one line at a time rather than a query at a time.
This is awkward as I have to press up multiple times just to get the same query, made all the more difficult by the fact that the first line I add gets added back to the end of the history which adds an extra click. So in this example below I have to click up 25 times just to edit one line of this fairly small query.
usql:
psql on the other jumps back to the complete previous command with 1 up click and I can then navigate and update the query however I want and re-execute it very quickly.
psql:
It would be great if usql could be updated to match this behaviour as it would be a big boost in productivity with the tool.
How I would suggest it works is:
select foo from;
as the user would likely want to just jump back and correct it without re-typing everything (psql also does this). This prevents the issue where the line selected keeps getting appended back onto the history before we've even executed it.The text was updated successfully, but these errors were encountered: