The cursor in the QTextEdit field for "Description of change" for datalad save jumps to the beginning of the text after every letter, leading to inverted text when trying to write normally:
Technically, this is a cursor jumping, and not the text going right to left. If I insert a letter in the middle of the text, the cursor jumps to the beginning. I only observed this behaviour for this one field.
Steps to reproduce
Select Datalad -> Save the state in a dataset (or the right-click equivalent) and type in the "Description of change" field
Further comments
I tried fixing it, and found it directly related to this piece of code for datalad_gooey.param_widgets.TextParameter (excluding this code stops cursor from moving behavior):
Other fields based on the QLineEdit widget call the QLineEdit.text() in analogous function.
The QTextEdit does not have .text() method, so QTextEdit.toPlainText() is used instead. However, the docs for toPlainText say:
This property holds the text editor’s contents as plain text..
Previous contents are removed and undo/redo history is reset when the property is set. currentCharFormat() is also reset, unless textCursor() is already at the beginning of the document.
If the text edit has another content type, it will not be replaced by plain text if you call toPlainText(). The only exception to this is the non-break space, nbsp;, that will be converted into standard space.
I tried:
replacing QTextEdit with QPlainTextEdit - no change in behavior (but still might be a more fitting option)
Replacing self.input_widget.toPlainText() with self.input_widget.document.toPlainText() - no change
Doing the below, which made the cursor always jumps to the end, even when trying to insert some text in the middle, so no good:
c = self.input_widget.textCursor()
self.set(self.input_widget.toPlainText())
self.input_widget.setTextCursor(c)
The cursor in the
QTextEdit
field for "Description of change" fordatalad save
jumps to the beginning of the text after every letter, leading to inverted text when trying to write normally:Technically, this is a cursor jumping, and not the text going right to left. If I insert a letter in the middle of the text, the cursor jumps to the beginning. I only observed this behaviour for this one field.
Steps to reproduce
Select Datalad -> Save the state in a dataset (or the right-click equivalent) and type in the "Description of change" field
Further comments
I tried fixing it, and found it directly related to this piece of code for
datalad_gooey.param_widgets.TextParameter
(excluding this code stops cursor from moving behavior):https://github.com/datalad/datalad-gooey/blob/0d202f3fd0889eb70c97f67ec8133fe114470f72/datalad_gooey/param_widgets.py#L221-L222
Other fields based on the
QLineEdit
widget call theQLineEdit.text()
in analogous function.The
QTextEdit
does not have.text()
method, soQTextEdit.toPlainText()
is used instead. However, the docs for toPlainText say:I tried:
QTextEdit
withQPlainTextEdit
- no change in behavior (but still might be a more fitting option)self.input_widget.toPlainText()
withself.input_widget.document.toPlainText()
- no change