🚀 feat(query-history): append history queries without replacing#192
Open
Mrthnx wants to merge 1 commit intoMaxteabag:mainfrom
Open
🚀 feat(query-history): append history queries without replacing#192Mrthnx wants to merge 1 commit intoMaxteabag:mainfrom
Mrthnx wants to merge 1 commit intoMaxteabag:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the ability to append a query from history to the editor without replacing the current text. Previously, selecting a query from history (via
QueryHistoryScreenor Telescope) would overwrite whatever was in the editor. Now users can pressato append the selected query instead.Motivation
When working with query history, it's common to want to reuse or combine previous queries. The existing behavior (
<enter>) replaces the entire editor content, which is destructive if you're building a multi-statement query or referencing previous snippets. Appending provides a non-destructive alternative.Changes
1. New
_append_history_query()methodAdded to
QueryExecutionMixin(sqlit/domains/query/ui/mixins/query_execution.py):_push_undo_state()2. New
appendaction inQueryHistoryScreenAdded to
sqlit/domains/query/ui/screens/query_history.py:a→action_appendAppend (a)alongside existing actions("append", entry)result to the caller3. Handle
appendaction in result handlersUpdated both
_handle_history_resultand_handle_telescope_resultinQueryExecutionMixinto handle the new"append"action and delegate to_append_history_query().How to test
H) or Telescope (Ctrl+T)aKeymap
<enter>a*d