Skip to content

Correctly check currently active text editor

Lucid Sunlight requested to merge awakening/krita:text-editor-mode-fix into master

Previously, we would only check the index of the tab we're on, which would work as expected in Rich Text Only and Both editor modes. But in SVG Source Only mode, it would mistakenly think we're on rich text editor, instead of SVG editor.

That breaks saving, as we were trying to save text document instead of SVG. Would crash in KoSvgTextShapeMarkupConverter::convertDocumentToSvg as the text document would have no text. Or empty the text object if we try to avoid the crash.

Also keep settings button always active on all editor modes, otherwise we can lock the user out, if user changes to SVG source only.

Test Plan

  • Create a text object
  • Open text editor settings
  • Switch to SVG source only mode
  • Save the text object
  • Don't crash or empty the text object
  • Change something in SVG source, e.g. the text
  • Save the text object
  • See changes properly applied to the text object
  • Be able to access settings and switch editor mode

Formalities Checklist

  • I confirmed this builds. (on master and krita/4.3)
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports