Skip to content
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

[Bug]: Hashtags autocompletion / keyword popularity statistics popover breaks when editing a hashtag that is followed by regular words #920

Open
nekohayo opened this issue Apr 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@nekohayo
Copy link

Describe the bug

This is the 2024 Edition™ follow-up to #660 :)

The hashtags autocompletion+stats widget can still break under some circumstances: It does not like me changing my mind and using backspace + rewriting an existing hashtag in a draft. This occurs frequently when trying to iteratively figure out the best hashtag to use while drafting.

Symptoms (as observed in the video below):

  • Most of the time the autocompletion stats widget does not show up at all
  • Sometimes it also erronously parses adjacent words into it

Steps To Reproduce

See demonstration video below. Basically:

  1. Type out a hashtag
  2. Type some non-hashtag words afterwards
  3. Go back to the end of your hashtag word, backspace and try to change the hashtag to something else

Logs and/or Screenshots

breaking.tuba.autocompletion.by.editing.2024.edition.webm

Instance Backend

Mastodon

Operating System

Fedora 39

Package

Flatpak

Troubleshooting information

os: GNOME 46 (Flatpak runtime)
prefix: /app
flatpak: true
version: 0.7.2 (production)
gtk: 4.14.1 (4.14.1)
libadwaita: 1.5.0 (1.5.0)
libsoup: 3.4.4 (3.4.4)
libgtksourceview: 5.12.0 (5.12.0)

Additional Context

No response

@nekohayo nekohayo added the bug Something isn't working label Apr 21, 2024
@nekohayo
Copy link
Author

"overwriting" (i.e. ctrl+shift+left to select the whole word, then just type a replacement) also breaks in new and exciting ways ;)

breaking.tuba.autocompletion.by.editing.2024.edition.part.2.webm

@GeopJr
Copy link
Owner

GeopJr commented Apr 21, 2024

What did past me mean by this:

		// If end is ':', everything until
		// a newline will be treated as a word
		if (end.get_char () != ':')
			end.forward_word_end ();

@GeopJr
Copy link
Owner

GeopJr commented Apr 21, 2024

the comment is wrong, the comment doesnt even tell me why

@GeopJr
Copy link
Owner

GeopJr commented Apr 22, 2024

The main issue is that i'm fighting both the completionprovider and pango,
pango treats foo#bar as 2 words, foo and bar, supposedly # being the word break
then completionprovider bounds are from the pango word start until the cursor, so if you have abc#defgh and your cursor is between f and g, it will return def 😩

I'm going to rewrite this again, but any input would be appreciated:
We'll get the word bounds, then move backwards until we find a space, then move one forward and check if it's a provider trigger e.g. #, @, :. Then from the end, move forward until we find a space (and move one back) or word end. That will return the full word.

When replacing, we'll add a space at the end if there's not one already

Hopefully it won't have too much of a performance impact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants