Patch Messaging Jump Forward, Backward One Word at a Time

From WebOS Internals
Jump to navigation Jump to search


Summary

Sym+f : jump backwards one word
Sym+g : jump forwards one word

Description

It's very easy to fat finger while thumbing out a message and difficult to tap the cursor into the right position to correct a typo. Not having arrow keys to move the cursor drove me nuts, especially when the typo was near the submit icon -- oops accidentally sent garbage because my fingertip wasn't sharp enough. This patch allows Sym+f to jump backwards one word and Sym+g to jump forward one word. This, plus the built-in Sym+Backspace to delete the current word makes fixing typos much easier. Most other Sym+key combinations are shortcuts for other symbols but f and g were unused.

Prerequisites

  • Rooted phone.

Process

  1. Log in as root.
  2. Mount the file system as RW.
  3. Enter the /usr/palm/applications/com.palm.app.messaging/app/controllers directory.
  4. In chatview-assistant.js, locate the handleTextAreaUp event handler near line 1680 (1800 for me):
    <source lang="text"> handleTextAreaKeyUp: function(event) {</source>
    and add the following just after:
    <source lang="text"> if (event && event.ctrlKey && event.keyCode==Mojo.Char.f) {
    currentText=this.messageTextElement.value;
    oldPos = this.messageTextElement.selectionStart;
    newPos = currentText.lastIndexOf(' ',oldPos-1);
    if (newPos>-1) {
    this.messageTextElement.setSelectionRange(newPos,newPos);
    }
    else {
    this.messageTextElement.setSelectionRange(0,0);
    }
    Event.stop(event);
    }
    if (event && event.ctrlKey && event.keyCode==Mojo.Char.g ) {
    currentText=this.messageTextElement.value;
    oldPos = this.messageTextElement.selectionStart;
    newPos = currentText.indexOf(' ',oldPos);
    if (newPos>-1) {
    this.messageTextElement.setSelectionRange(newPos+1,newPos+1);
    }
    else {
    this.messageTextElement.setSelectionRange(currentText.length,currentText.length);
    }
    Event.stop(event);
    } </source>
  5. Mount the file system as RO.
  6. Reboot.