by using the right function to figure the location of both kinds of
cursors. Also fix crash in my last cursor movement commit: check for
error values returned by pango_layout_move_cursor_visually() and don't
try to move the cursor beyond the buffer boundaries.
instead of duplicating GimpTextLayout's positioning logic in two
different incomplete ways. Also gets rid of the unrelated offset
return values of gimp_text_tool_editor_get_cursor_rect().
Pull all text buffer utility functions as methods and use
GimpTextBuffer all over the place instead of GtkTextBuffer.
Some actually usefuly features coming soon...
This has several advantages:
- it's always readable, no matter how sick font/colors are.
- it does not mess up the buffer, which is a model that should not
contain temporary edit states.
- preediting does not clutter undo.
- it fixes the remaining bugs in the old preediting code because that
code is completely gone now.
- Reset the IM context in much more situations, like on button_press
and when the text editor is initialized and halted (pretty much what
GtkTextView does).
- As a consequence, halt the rectangle text tool after the text tool
in control() because cancelling the IM preedit might cause a
re-framing of the layer because it resized.
- pause()/resume() the draw tool around gimp_text_tool_halt() so we
definitely avoid drawing atrifacts when the text tool is shut down
in the middle of an IM preedit. That pause/resume pair should have
been there from the beginning actually.
Feed them into the text editor's IM context and into the proxy text
view's key bindings. Fixes input methods (e.g. entering of unicode
sequences seems to work flawlessly now).