timewarrior icon indicating copy to clipboard operation
timewarrior copied to clipboard

Tab completion cuts hyphenated tags

Open Igetin opened this issue 1 year ago • 11 comments

When there are hyphenated tags, the tab completion only completes to the first hyphen, and the rest of the tag is missing.

Demonstration:

[09:55:42] ❯ timew start main-unit
Note: '"main-unit"' is a new tag.
Tracking "main-unit"
  Started 2023-12-12T09:55:42
  Current                  42
  Total               0:00:00
[09:55:45] ❯ timew stop
Recorded "main-unit"
  Started 2023-12-12T09:55:42
  Ended                    45
  Total               0:00:03
[09:55:52] ❯ timew start secondary-unit
Note: '"secondary-unit"' is a new tag.
Tracking "secondary-unit"
  Started 2023-12-12T09:55:52
  Current                  52
  Total               0:00:00
[09:55:55] ❯ timew stop
Recorded "secondary-unit"
  Started 2023-12-12T09:55:52
  Ended                    55
  Total               0:00:03
[09:55:57] ❯ timew tags

Tag            Description
main-unit      -
secondary-unit -

[09:56:00] ❯ fish

❯ timew start [TAB]
main  secondary
  • Shell: Fish 3.6.1
  • Timewarrior: 1.6.0 and 1.7.0

Igetin avatar Dec 12 '23 07:12 Igetin

@Igetin For completeness: Which version of Timewarrior are you using?

lauft avatar Dec 12 '23 18:12 lauft

@Igetin For completeness: Which version of Timewarrior are you using?

Sorry, I thought I added that information to the post, but maybe I removed it by accident. 😅 I’m using the latest release (1.6.0). It’s installed via the distro package manager (DNF/Fedora). My shell is Fish 3.6.1.

Edit: I also tested that this is reproducible with the default Fish configuration and without any plugins installed.

Igetin avatar Dec 12 '23 18:12 Igetin

@Igetin The good news is that this issue is already fixed with 3e66ee19, so it will be part of the next Timewarrior release.

However, I found another issue (👉🏻 #576) while investigating this, which I also want to fix. Should not take that long, but please be patient. 🙂

lauft avatar Dec 14 '23 21:12 lauft

I have now updated Timewarrior, but the problem is still reproducible with the steps mentioned in the thread opener.

  • Fish version: 3.6.1
  • Timewarrior version: 1.7.0

Igetin avatar Jan 08 '24 12:01 Igetin

@lauft Can this be reopened? This is still reproducable on Timewarrior 1.7.1 / Fish 3.7.0.

Igetin avatar Apr 30 '24 08:04 Igetin

@Igetin can you let me know if this if this fix solves your issue? https://github.com/pfmephisto/timew-fishcompletion/pull/3

pfmephisto avatar Jun 05 '24 07:06 pfmephisto

@Igetin can you let me know if this if this fix solves your issue? pfmephisto/timew-fishcompletion#3

I tried the updated completion script, it seems now that there's a weird thing where it adds seemingly unrelated symbols after each tab entry? When I type timew start and press tab twice, this is how it looks:

root@e9bfbde733f6 /# timew start another-project\ \ca 
another-project ␁  project ␁

Same thing as an image: image

So the prompt is appended with \ \ca , and the entries in the tab completion list are appended with (start of heading)…

This is with a fresh install of Fedora 40 / Timewarrior 1.7.1 / Fish 3.7.0.


Another issue I noticed is that the completion does not suggest new tags that have been added in the current shell session. Newly added tags are only suggested by the completion after starting a new shell session.

Igetin avatar Jun 16 '24 09:06 Igetin

@pfmephisto can you investigate once again? 🙇🏻

lauft avatar Jun 21 '24 16:06 lauft

I will. Just need to find the time to recreate the issue and look in to it.

pfmephisto avatar Jun 21 '24 17:06 pfmephisto

I've submitted a pull request to fix this. I'm no AWK wizard, but it seems to work for me. I also tested with tags that contain spaces. I'd like someone else to verify it's working on their end as well.

Igetin avatar Aug 07 '24 14:08 Igetin

@Igetin Thanks @lauft The pull request is merged

pfmephisto avatar Aug 13 '24 13:08 pfmephisto