-
Notifications
You must be signed in to change notification settings - Fork 14
Allow for tags with whitespaces and special characters #30
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -515,3 +515,24 @@ def key_string(e: QKeyEvent) -> str: | |
|
|
||
| # print(cmd) | ||
| return cmd | ||
|
|
||
| def format_tag_args(tag_expr: str=None, tags_add: list=None, tags_remove: list=None) -> list: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems wrong. Additional quotes actually passed to notmuch are only required when a shell is involved, but this isn't the case here. I'm pretty sure this would now add the tags with the quotes, like doing
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. I'll have to test this out. What you say makes sense I could see it adding the double quotes to the tags themselves. Yet in search and tag view I definitely needed the double quotes for some parts. I can review the different cases and print what the actual commands being sent to notmuch are and if they work as expected. As noted I still haven't tested adding/removing tags, just mainly search and tag view. Also furthering that in #31
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a query, that's true - from what I understand, that uses Xapian query syntax, which needs literal quotes:
Compare that to shell usage, where |
||
| tag_args = [] | ||
| if tag_expr: | ||
| # This is something typed by the user in the search or thread panel | ||
| # assume that they use whitepace and quotes correctly | ||
| for tag in shlex.split(tag_expr): | ||
| if tag[0] not in ['+', '-']: | ||
| tag = '+' + tag | ||
| if ' ' in tag: | ||
| # For example: shlex.split('+asdf +"asdf asdf"') => ['+asdf', '+asdf asdf'] | ||
| # shelx.split removed quotes, so add them back | ||
| tag = tag[0] + f'"{tag[1:]}"' | ||
| tag_args.append(tag) | ||
| if tags_add: | ||
| for tag in tags_add: | ||
| tag_args.append(f'+"{tag}"') | ||
| if tags_remove: | ||
| for tag in tags_remove: | ||
| tag_args.append(f'-"{tag}"') | ||
| return tag_args | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops this should be in util.py instead