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

feature request - nice quoting functionality. #58

Open
rnmhdn opened this issue Aug 30, 2018 · 5 comments
Open

feature request - nice quoting functionality. #58

rnmhdn opened this issue Aug 30, 2018 · 5 comments

Comments

@rnmhdn
Copy link

rnmhdn commented Aug 30, 2018

I think these commands can be so nice and handy.

:<num>m (quote line <num> message)
:<num>q (quote msg + nick)
:<num1>,<num2>m (copy msgs from lines num1 to num2 to input_text)
:<num1>,<num2>q (...)
@GermainZ
Copy link
Owner

Unfortunately, this doesn't seem to be possible yet.

Notes (mostly to myself, but also to anyone who might want to investigate):

  1. q/Q/m in cursor mode do some special things (see /key list cursor).
  2. We can't do the same thing as it depends on the focus hashtable, and hook_focus() is only called on user input, once the cursor mode is active.
  3. Accessing the buffer's lines directly (using hdata methods) doesn't give us info about the line number, so things break for wrapped lines.

A hacky way would be to do it via the xdotool program (or similar), but that would only allow :<num>m and :<num>q, without support for ranges.

I can revisit this if weechat/weechat#1245 is resolved, but this is an admittedly niche issue and the WeeChat contributors might have other priorities. :)

@rnmhdn
Copy link
Author

rnmhdn commented Sep 1, 2018

I don't know much about weechat API but I was thinking maybe something like this would work:
when user does :4,5m we do the following silently:
:4
m
save the value in text_input to a local array variable, say lines[0]
:5
m
save the value in text_input to lines[1]
text_input='\n'.join(lines)

  • (if possible in a way that the user would get the warning for pasting multiple lines.)
  • but also doing it without the warning has the benefit that the user would be able to do yy and save that text to clipboard which is also a very good thing.
  • of course it would be best if we could have both functionalities but I don't think it's possible so I think the "yy-aware" functionality would be better because it's a good thing and it's much easier to implement.

another way would be to just loop over the range and do :num and then paste and send. but the first solution would be much better because this one neither has the warning nor the yy functionality.

@GermainZ
Copy link
Owner

GermainZ commented Sep 1, 2018

I can't send the "m" keystroke (or whatever key, short of using xdotool) nor do its action directly in the script programmatically (this may be possible in the future, see the issue I linked above).

@rnmhdn
Copy link
Author

rnmhdn commented Sep 1, 2018

oh... my bad... sorry:D

@rnmhdn rnmhdn closed this as completed Sep 1, 2018
@GermainZ GermainZ reopened this Sep 1, 2018
@GermainZ
Copy link
Owner

GermainZ commented Sep 1, 2018

This should be possible in a future WeeChat release / vimode update (I have a working implementation, but it requires a patch that isn't in WeeChat yet; the final implementation may also change), hopefully in a few months.

If someone wants to try it anyway, you have to build WeeChat from source and apply the above patch, then apply this patch to vimode.py.

I'm keeping the issue open for tracking purposes and as a reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants