I'm considering of adding a new inset (InsetNumber) for the purpose of
entering numbers in Right-To-Left text: when you press a digit key, instead
of inserting the digit into the current paragraph, a InsetNumber is inserted
and the digit is inserted to the inset.
I've implemented this inset as a derived class of InsetText. In this process,
I've encountered several bugs in InsetText. Before I list them, I want to
ask general question about the text inset:
1. What is its purpose? Is it supposed to replace the LyXText class?
2. Is it in a usable state? (if not, I can make the InsetNumber a derived
class of InsetFormula).
The bugs:
1. The cursor has wrong position after inserting/deleting a character
(try a putting an text inset in a right aligned paragraph).
The problem is that in InsetText::UpdateLocal, the cursor positioned is
recomputed before the x position of the inset is recomputed.
Here is a fix:
--- /home/dekel/lyx/src/insets/insettext.C Fri Mar 31 14:02:32 2000
+++ insets/insettext.C Sat Apr 1 01:42:47 2000
@@ -1308,9 +1308,10 @@ void InsetText::UpdateLocal(BufferView *
if (flag) {
computeTextRows(bv->painter(), xpos);
computeBaselines(top_baseline);
- resetPos(bv);
}
bv->updateInset(this, flag);
+ if (flag)
+ resetPos(bv);
ShowInsetCursor(bv);
}
2. In InsetText::LocalDispatch, there are two lines
par->SetFont(actpos,real_current_font);
(after inserting a char) but I think they should be
SetCharFont(actpos,current_font);
3. If you put a text inset in a Title paragraph, the display font inside
the inset is still the default font (instead of being a large bold font).
Also, if you change the font of a selection containing a text inset, the
display font inside the inset doesn't change.