mark2devel / mark2

Minecraft Multi Server Wrapper Written in Python with Twisted; Pull Requests HIGHLY Encouraged, Collaborators Needed Discord: https://discord.gg/zymJygHNpv
Other
205 stars 44 forks source link

Too easy to accidentally kick users - mouse focus issue #125

Closed synrg closed 3 years ago

synrg commented 3 years ago

If you click anywhere other than the footer (i.e. practically anywhere on the window!) focus is set on the users pane. Then the next thing you type very likely will end up with whoever is at the top of the list getting kicked. Even after doing this the first few times and figuring out what was happening, I found it was still difficult to avoid. Therefore, I set off to find a solution ...

My workaround for this is to add an innocuous # command at the head of the list in player-actions in my ~/.markrc.properties file.

player-actions=\
    #,\
    kick,\
    mute,\
    ban

With this in place, if you end up misclicking and focusing the first player, then type some more, it will not kick the user when you press space or enter. Instead, it will execute # username which does nothing but add the username to the log as a comment.

I had a long look through Urwid doc and the mark2 code and was unable to sort out exactly how to avoid the misfocusing behaviour in the first place. Ideally, it should only focus the players when you click on the players, not when you click anywhere else.

As an aside, I ran into this issue in the first place when I wanted to use the mouse to cut-and-paste something out of the log. This did not, in fact, achieve anything useful, as urwid grabbed the mouse events itself. Therefore, in a separate terminal I now just tail -f logs/latest.log to be able to grab recent lines from there instead. It would be nicer if lines could be selected via the mouse instead, but I don't know urwid well enough yet to know if this could be done. I'll happily create a second issue for it if it seems doable, but it's not my principal concern.

Column01 commented 3 years ago

Not entirely sure how we could fix this.

As for copying lines from the console, I don't think it would work as you would want, afaik we could only copy full lines from the console and even then I believe these focus issues would need to be fixed before that would even work.

synrg commented 3 years ago

Only copying full lines is indeed a problem, so copying directly from the log is a superior solution there.

The workaround is quite acceptable to me if this is a hard thing. We've had no accidental kicks since I put it in place.

Column01 commented 3 years ago

Personally, I've never accidentally kicked someone as I usually notice I'm not typing in the field in time, but your solution is quite good. Might consider having that there by default

synrg commented 3 years ago

Yeah, it's quite easy to misfocus even if you're not in the habit of trying to cut-and-paste from the window. Simply clicking in the middle of the terminal to focus it could land you in trouble is what I found. If you don't do either thing, though, I can see how you'd never discover it for yourself.

Column01 commented 3 years ago

@synrg Please make a new issue for the suggestion of copying text, I have an idea how it could be implemented, but it will still be a copy full line. Arguably more useful than having no way to copy text lol