Introducing OnTheSpot style of input methods

Yokota K. yokota6 at gmail.com
Wed Nov 6 08:48:44 UTC 2024


> This looks very interesting. I have plenty of style comments, but I'd like first to understand what you are doing.

Many thanks for looking at it. As there can be inefficient or inappropriate usages which comes from my short experience in C++, I’m more than glad if you could point them out if there are any.

>> The main code goes into new InputMethod and GuiInputMethod classes but there are some modifications in other classes, notably Row, TextMetrics and GuiWorkArea. Ui files are modified as well, but their change is basically to add ImHints properties to the text inputs. Other modifications in Ui files are automatically made by the editor of QtCreator.
>> There is a little concern if I can safely remove a check around Line 1959 in Paragraph.cpp or relax the boundary around Line 762 in Row.cpp. They are changed since uncounted virtual preedit strings can push the character position beyond those boundaries.
> 
> This is the part I am interested in (unsurprisingly, I cannot comment much on the IM machinery itself).
> 
> Could you explain what happens with the positions in the paragraph when the preedit string is added? I'd like to understand the changes that you need to do.
> 
> Do you plan to allow to move cursor during preediting?

Basically, the cursor needs to follow inputs as in normal editing during preediting. Actually, in the second patch, I changed the behavior of Row::Element::pos2x by utilizing the introduction of new PREEDIT row element so that it counts the length of preedit strings.

So, I think Line 762 in Row.cpp now can go with the original condition.

I kept the if condition
	(cit->isPreedit() && pos + boundary_corr <= cit->pos)
in the second patch for safety, but I think it can be safely removed.

# The new behavior in the second patch is that Row::Element::pos2x counts the length of preedit strings as well as Row::findElement and BufferView::caretPosAndDim (they counted preedit strings as zero length in the first patch).

Line 1959 in Paragraph.cpp still needs to be commented out. When preedit strings just goes into the second row, row.pos() in TextMetrics::setRowHeight (L.1399 in TextMetrics.cpp) reports the starting point of the new (virtual) row once, which exceeds the size() of paragraph that doesn’t count preedit strings. I’m not sure yet but row boundary treatement somehow causes this behavior.

Koji




More information about the lyx-devel mailing list