[LDTP-Dev] [Bug 343883] getcursorposition only suiteable for single line text

LDTP (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Sun Aug 13 22:39:25 PDT 2006


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=343883
 LDTP | ldtp | Ver: 0.4.x


Prashanth Mohan changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|general                     |ldtp




------- Comment #2 from Prashanth Mohan  2006-08-14 05:39 UTC -------
I think, this can be handled in the client itself using a function such as:
def getcood(text, cursorpos):
    row = 1
    col = 1
    pos = 0
    for char in text:
        if pos > cursorpos:
            break
        if char == '\n':
            row += 1
            col = 1
        elif char == '\t':
            col = ((col/8)+1)*8
        col += 1
        pos += 1
    return row, col

This will work in gedit for both word wrapping on and off (as reported by the
status bar although text might appear on the next line)


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are watching the assignee for the bug.


More information about the LDTP-dev mailing list