Finish the surrounding text implementation

Bug report: https://code.google.com/p/ibus/issues/detail?id=1698