patch to improve focus handling of the tabbed chat

capitol

New member
Hi

I have now done some real development instead of just cosmetic changes to the code ;)

Here is a patch that improves the way that focus is handled on the tabbed chat, it moves focus to the input box every time that the window gains focus.

This makes it possible to tab to the chat and start typing directly, even if you somehow managed to move away focus from the input field when you tabbed away (something that I manage to do way to frequently).

I have also added a unit test for the StateListener, I noticed that there wasn't any unit tests to begin with, so I took the liberty to add some infrastructure in the build file for running them. What's also needed is to place the junit ( https://github.com/downloads/KentBeck/junit/junit4.10.zip ) and mockito ( http://code.google.com/p/mockito/downloads/detail?name=mockito-1.9.5-rc1.zip ) jars in a folder called util/test/ as these ain't included in the patch.

The reason i opted to place the ChatWindowStateListener as a public class instead of as an internal private one was to be able to easily write tests for it, the style otherwise seems to be to place such classes as private internal ones, but that makes them hard to test.

the patch: http://frikod.se/~capitol/chatFocus.patch

and the commit on github: https://github.com/alexanderkjall/kolmafia/commit/7b3683f3c712c368d56975586fceff1a9cd44eaf

best regards
Alexander Kjäll
 

Catch-22

Active member
I could see at least the first part being useful for people who use chat in KoLmafia. I wouldn't have lumped the 2nd change into the same patch though.

Normally what you would do is open a Feature Request describing the problem (in this case, chat tab focus) in detail and attach a patch which addresses that specific issue. The patch, adding just the functionality mentioned in the feature request, then gets reviewed by a dev. If they approve it, it will get patched in. Bundling a bunch of stuff in with one patch makes the review process harder on the devs.

I would've made two separate feature requests with corresponding patches for each, one detailing the issue with the chat tab focus, and another requesting unit testing framework support.

Edit: I should also add that, because you're working on what is essentially a fork of KoLmafia, your patches are going to get harder and harder to manage as (I imagine) the diffs are going to be against your codebase, not the current codebase in KoLmafia. I really suggest you try to get SVN working, if you need assistance with that, feel free to ask in the forums.
 
Last edited:

capitol

New member
Sounds like a good idea to break the patch into two different ones, I'll do that and add them to the tracker.

Regarding svn, it's such a horrible step backwards in functionality to start using svn instead of git, so I won't do that, but what i can do is to start using a git-svn clone of your svn repo, that way I can continue to track and merge the changes everyone else does into my branch.
 
Top