I've been working on this patch for a while now, but I just can't work out how to
finish it. I know what I want it to do, but just can't work out how to do it.
Any help, suggestions or ideas on how to fix it would be greatly appreciated.
There's more info/comments inside the patch, which should fully explain what I
am trying to do/achieve.
Thanks (in advance)
Here it is...