count keystrokes as activity and handle edit mode correctly