scripts icon indicating copy to clipboard operation
scripts copied to clipboard

go.py: use buf number instead of name

Open craftyguy opened this issue 3 years ago • 2 comments

Script info

  • Script name: go.py 
  • Version: 
  • Requirements: 
  • Min WeeChat version: 
  • Script tags: 

Description

This fixes some issues when switching to a buffer, when the buffer's name is something that weechat does not like, e.g. "#Foo < Bar"

weechat =!= Error with command "/buffer #Foo < Bar" (help on command: /help buffer)

These aren't really valid channel names(I think?), but some weechat plugins (weechat-matrix) may create buffers with incompatible names like that. In any case, switching based on the buffer number seems to be a reliable compromise.

craftyguy avatar Sep 05 '22 21:09 craftyguy

Hi,

Thanks for the PR.

Switching to the number has not the same effect as the name: if buffers are merged, using the number may not activate the target buffer.

So I would not change that, but instead fix plugins/scripts that open buffers with bad name, or maybe better, make WeeChat refuse completely to create these buffers, which will force plugins/scripts to sanitize names before creating buffers.

flashcode avatar Sep 06 '22 06:09 flashcode

By the way your command example /buffer #Foo < Bar works for me (I created such test buffer), no such error. Which version of WeeChat are you using?

flashcode avatar Sep 06 '22 06:09 flashcode

Changes are not needed for me, so I close the pull request.

flashcode avatar Feb 07 '23 19:02 flashcode