After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 343883 - getcursorposition only suiteable for single line text
getcursorposition only suiteable for single line text
Status: RESOLVED INCOMPLETE
Product: LDTP
Classification: Other
Component: ldtp
0.4.x
Other All
: Normal minor
: ---
Assigned To: LDTP maintainers
LDTP Development Mailing List
: 350910 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-06-05 08:37 UTC by Alex.Yu
Modified: 2009-01-19 19:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alex.Yu 2006-06-05 08:37:28 UTC
if there is a multi-line text, the function only returns the column position of cursor, also need to return row position of cursor

Other information:
Comment 1 Prashanth Mohan 2006-06-22 18:29:27 UTC
The getcursorposition() function returns the position of the caret in the textbox, i.e. the characters before the caret position, it does not return the column or row numbers.
Comment 2 Prashanth Mohan 2006-08-14 05:39:03 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)
Comment 3 Prashanth Mohan 2006-08-14 05:52:54 UTC
*** Bug 350910 has been marked as a duplicate of this bug. ***
Comment 4 Nagappan Alagappan 2008-01-17 23:52:49 UTC
Alex: The suggestion from Prashanth worked for you ?
Comment 5 Christoph Wurm 2009-01-19 19:46:18 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for.
Thanks!