}
-bool Text::isRTL(Paragraph const & par) const
+bool Text::isRTL(pit_type const pit) const
{
Buffer const & buffer = owner_->buffer();
- return par.isRTL(buffer.params());
+ return pars_[pit].isRTL(buffer.params());
}
break;
}
+ case LFUN_PARAGRAPH_SELECT:
+ if (cur.pos() > 0)
+ needsUpdate |= setCursor(cur, cur.pit(), 0);
+ needsUpdate |= cur.selHandle(true);
+ if (cur.pos() < cur.lastpos())
+ needsUpdate |= setCursor(cur, cur.pit(), cur.lastpos());
+ break;
+
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_UP_SELECT:
needsUpdate |= cur.selHandle(cmd.action() == LFUN_PARAGRAPH_UP_SELECT);
case LFUN_MOUSE_TRIPLE:
if (cmd.button() == mouse_button::button1) {
- tm->cursorHome(cur);
+ if (cur.pos() > 0)
+ setCursor(cur, cur.pit(), 0);
+ bv->cursor() = cur;
cur.resetAnchor();
- tm->cursorEnd(cur);
+ if (cur.pos() < cur.lastpos())
+ setCursor(cur, cur.pit(), cur.lastpos());
cur.setSelection();
bv->cursor() = cur;
}
}
case LFUN_TABULAR_INSERT: {
- if (cur.buffer()->masterParams().tablestyle != "default") {
- FuncRequest fr(LFUN_TABULAR_STYLE_INSERT,
- cur.buffer()->masterParams().tablestyle + " "
- + to_ascii(cmd.argument()));
- lyx::dispatch(fr);
+ // if there were no arguments, just open the dialog
+ if (cmd.argument().empty()) {
+ bv->showDialog("tabularcreate");
break;
+ } else if (cur.buffer()->masterParams().tablestyle != "default"
+ || bv->buffer().params().documentClass().tablestyle() != "default") {
+ string tabstyle = cur.buffer()->masterParams().tablestyle;
+ if (tabstyle == "default")
+ tabstyle = bv->buffer().params().documentClass().tablestyle();
+ if (!libFileSearch("tabletemplates", tabstyle + ".lyx").empty()) {
+ FuncRequest fr(LFUN_TABULAR_STYLE_INSERT,
+ tabstyle + " " + to_ascii(cmd.argument()));
+ lyx::dispatch(fr);
+ break;
+ } else
+ // Unknown style. Report and fall back to default.
+ cur.errorMessage(from_utf8(N_("Table Style ")) + from_utf8(tabstyle) +
+ from_utf8(N_(" not known")));
+
}
- // if there were no arguments, just open the dialog
if (doInsertInset(cur, this, cmd, false, true))
cur.posForward();
- else
- bv->showDialog("tabularcreate");
-
break;
}
cur.recordUndo();
FuncRequest cmd2(LFUN_FILE_INSERT, tabstyle.absFileName() + " ignorelang");
lyx::dispatch(cmd2);
+ // go into table
+ cur.backwardPos();
if (r > 2) {
- // go into table
- cur.backwardPos();
// move one cell up to middle cell
cur.up();
- // now add the missing rows and columns
+ // add the missing rows
int const addrows = r - 3;
- int const addcols = c - 1;
for (int i = 0 ; i < addrows ; ++i) {
FuncRequest fr(LFUN_TABULAR_FEATURE, "append-row");
lyx::dispatch(fr);
}
- for (int i = 0 ; i < addcols ; ++i) {
- FuncRequest fr(LFUN_TABULAR_FEATURE, "append-column");
- lyx::dispatch(fr);
- }
+ }
+ // add the missing columns
+ int const addcols = c - 1;
+ for (int i = 0 ; i < addcols ; ++i) {
+ FuncRequest fr(LFUN_TABULAR_FEATURE, "append-column");
+ lyx::dispatch(fr);
+ }
+ if (r > 1)
// go to first cell
cur.up();
- } else {
- // jump over table
- cur.backwardChar();
- // go to first cell
- cur.forwardPos();
- }
break;
}
case LFUN_UP_SELECT:
case LFUN_DOWN:
case LFUN_DOWN_SELECT:
+ case LFUN_PARAGRAPH_SELECT:
case LFUN_PARAGRAPH_UP_SELECT:
case LFUN_PARAGRAPH_DOWN_SELECT:
case LFUN_LINE_BEGIN_SELECT: