Bug 479666 - [On-canvas text] Cursor position is not updated when typing the first character
Summary: [On-canvas text] Cursor position is not updated when typing the first character
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: wolthera
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-11 20:47 UTC by ll3006
Modified: 2024-01-13 17:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ll3006 2024-01-11 20:47:18 UTC
STEPS TO REPRODUCE
1. Create a text box using the Text Tool
2. Type something in the on-canvas editor (e.g. "Test")

OBSERVED RESULT
The cursor position is not updated for the first character, which results in it appearing at the end of the line (e.g. "estT").

EXPECTED RESULT
The cursor is updated for the first character so that text can be typed in correctly (e.g. "Test").

SOFTWARE/OS VERSIONS
OS: Linux Mint 21.2 (Ubuntu 22.04 based) 
Qt Version: 5.13.3
Krita Version: git-42435f690a (custom built)
 
ADDITIONAL INFORMATION
Through git bisect, I found this has been present since b76f8e4b4c.
Comment 1 wolthera 2024-01-11 21:18:32 UTC
Yeah, I had noticed it already, but the holidays + other work have prevented me from fixing it. Basically what needs to be done is that right now the cursor pos defaults to -1 if it can't find anything, and that should be accounted for in the text insertion command.
Comment 2 wolthera 2024-01-12 17:32:21 UTC
Git commit 4cd5a06432bd303db4bdedb712309a00b03ab6b7 by Wolthera van Hövell tot Westerflier.
Committed on 12/01/2024 at 18:31.
Pushed by woltherav into branch 'master'.

Text: ensure that the insertion index is valid.

The index defaults to -1 when there's no text.

M  +2    -1    plugins/tools/svgtexttool/SvgTextInsertCommand.cpp

https://invent.kde.org/graphics/krita/-/commit/4cd5a06432bd303db4bdedb712309a00b03ab6b7
Comment 3 ll3006 2024-01-13 17:46:16 UTC
Thanks for the quick fix, love the work you've been doing on this feature!