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

removing a line in a hook_line differ between free and formatted buffer #2090

Open
pascalpoitras opened this issue Mar 9, 2024 · 1 comment
Assignees
Labels
bug Unexpected problem or unintended behavior

Comments

@pascalpoitras
Copy link

pascalpoitras commented Mar 9, 2024

Describe the bug

as answered by @flashcode in the issue #2087, to remove a line in a weechat_print modifier, a simple /.*// is enough, in a hook_line you must remove the buffer from buffer_name.

but when you use hook_line on a free buffer it doesn't behave this way, I mean, all you have to do is a /.*// to remove the line, you don't have to remove the buffer from buffer name.

not sure if this is a bug, I would like to know before pursuing what I'm doing since it change the way I have to implement it

Steps to reproduce

  1. /trigger add test line "*;core.my_buffer_*" "" "/.*test.*//"
  2. /print -switch -newbuffer my_buffer_formatted test
  3. a blank line is there as expected since we didn't touch buffer_name
  4. /print -switch -newbuffer my_buffer_free -free test
  5. no line is printed at all but we didn't touch buffer_name...
  6. proof, print a non test line it will be the first line of the buffer
  7. /print -switch -newbuffer my_buffer_free -free hello

Current behavior

the behavior is not the one defined by FlashCode in the following issue #2087. So it's either a bug or he forgot to mention that it behave differently in a free buffer

Expected behavior

should print a blank line according to issue #2087

Suggested solutions

No response

Additional information

No response

WeeChat version

4.3.0

What OS are you using?

Debian 12

On which terminal are you running WeeChat?

No response

Which terminal multiplexer are you using?

No response

@pascalpoitras pascalpoitras added the bug Unexpected problem or unintended behavior label Mar 9, 2024
@flashcode
Copy link
Member

In fact this is normal because of a specificity of free buffers: when you print a line with an empty message, this deletes the line.

If the hook_line is modified to do that, that means deleting a line on free buffer must be done with another way, and this have impact on scripts doing this.

I'm going to document this in the hook_line API function.

@flashcode flashcode self-assigned this Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants