X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText3.cpp;h=7e24041cef7f7918aa64dd6341970f44b8e613ea;hb=1e519d1115f41f71c253cb9e2fbb7803e9a583a9;hp=e51d323e03733b9d17be95dd7c6bef4ee4b4b8f2;hpb=ecb2427f4165a678304591cd38891873f1ad84a7;p=lyx.git diff --git a/src/Text3.cpp b/src/Text3.cpp index e51d323e03..7e24041cef 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -562,10 +562,10 @@ void Text::number(Cursor & cur) } -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()); } @@ -927,6 +927,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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); @@ -1762,9 +1770,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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; } @@ -2078,19 +2089,28 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } 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; } @@ -2117,30 +2137,27 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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; } @@ -3528,6 +3545,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, 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: