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

Add quote autocompletion for previous messages #1651

Merged

Conversation

MarcoPolo-PasTonMolo
Copy link
Collaborator

Fixes #1649

Type > then press tab or shift tab to autocomplete previous messages,
then type your reply and send message.
Newlines are replaced with newline followed by > .
A newline is added at the end so that the user can immediately type a
message without manually adding a new line.

I'm not sure if win_quote_autocomplete is in the correct file. I thought ui/window_list.c might have also been a good place to put it in since there are some other related functions there.

Fixes profanity-im#1649

Type `>` then press tab or shift tab to autocomplete previous messages,
then type your reply and send message.
Newlines are replaced with newline followed by `> `.
A newline is added at the end so that the user can immediately type a
message without manually adding a new line.
@jubalh
Copy link
Member

jubalh commented Mar 21, 2022

g_string_replace() is only available since glib 2.68.
I'll have to check which distros ship which version.

@jubalh
Copy link
Member

jubalh commented Mar 21, 2022

Debian 12 has 2.66.8
Fedora 36 has 2.71.1
openSUSE Leap 15.4 will have 2.70.4

@MarcoPolo-PasTonMolo
Copy link
Collaborator Author

Ok, I better change that then

@jubalh
Copy link
Member

jubalh commented Mar 21, 2022

You can also put some ifdef around it (I think we have that in other parts). And later when all distros have this version of the lib we will remove the alternative way.

@MarcoPolo-PasTonMolo
Copy link
Collaborator Author

Sorry I don't know how to do that

@jubalh jubalh added this to the 0.12.0 milestone Mar 21, 2022
@jubalh jubalh added the feature label Mar 21, 2022
@jubalh jubalh self-requested a review March 21, 2022 12:56

GString* replace_with = g_string_new("> ");
g_string_append(replace_with, quoted_result);
g_string_append(replace_with, "\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working for you? When I open in the editor I'm still on the same line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I open it in vim no, if I open it in another editor yes. Also if I don't open it in editor and just write something, the newline is indeed present.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@jubalh jubalh merged commit 5ea7186 into profanity-im:master Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add autocompletion for quotes
2 participants