Code52 / carnac

A utility to give some insight into how you use your keyboard
http://carnackeys.com/
Microsoft Public License
4.2k stars 506 forks source link

Add 'Disable Stacking' to settings #204

Open ZyadS29 opened 5 years ago

ZyadS29 commented 5 years ago

Add the option of disabling stacking ( x 9) for non-modifier keys

caleywoods commented 4 years ago

+1 for this feature / option. I don't know a ton of C# but I could maybe take a crack at implementing this.

caleywoods commented 4 years ago

I've done some research on this and it looks like the logic/code handling this is in the Message.cs model, calling IncremenetRepeat() method on the RepeatedKeyPress class which is also defined inside the Message model. A little further down in that file around L#190, GetTextParts() is responsible for formatting/rendering the stacked key combination where jjj -> j x 3.

I'll try adding in the logic to leave them ungrouped/aggregated and then see if I can wrap a setting around it where the default is to leave them grouped as they appear today. It may be as simple as skipping or returning false immediately in MergeIfNeeded() in Message if the Disable Stacking setting is enabled.

caleywoods commented 4 years ago

@shiftkey I have the disabling of stacking working in theory and I've put an option into the options form to control it. The issue I'm running into is that within Message.cs where I'm handing the disabling of the grouping of keys in CreateTextSequence(), I am struggling to figure out how to get access to the settings (PopupSettings).

It looks like in all the other places (such as MessageProvider), there's an instance/reference being injected via the constructor but Message doesn't have that and I'm not sure how to go about it without making it so that Message requires it. Is there a simple way to grab the settings from the Message class without injecting it as a dependency? Thanks for any help you can provide.

bfritscher commented 4 years ago

@caleywoods some part of filtering is also done in https://github.com/Code52/carnac/blob/master/src/Carnac.Logic/KeyProvider.cs#L63 which already has the settingsProvider injected.