Select the whole paragraph with tripple-left-click

Fixes #9175

Also added new function: paragraph-select.
This commit is contained in:
Kornel Benko 2019-04-16 19:50:31 +02:00
parent f6f08f0c50
commit e0f5641089
3 changed files with 24 additions and 2 deletions

View File

@ -484,6 +484,7 @@ enum FuncCode
LFUN_SEARCH_IGNORE, // kornel, 20181115
LFUN_BUFFER_WRITE_AS_TEMPLATE, // spitz, 20190323
LFUN_TABULAR_STYLE_INSERT, // spitz, 20190325
LFUN_PARAGRAPH_SELECT, // Kornel, 20190416
LFUN_LASTACTION // end of the table
};

View File

@ -3251,6 +3251,15 @@ void LyXAction::init()
*/
{ LFUN_PARAGRAPH_UPDATE, "", Noop, Hidden },
/*!
* \var lyx::FuncCode lyx::LFUN_PARAGRAPH_SELECT
* \li Action: Move cursor to beginning of current paragraph
and select to the end in downward direction
* \li Syntax: paragraph-select
* \li Origin: Kornel, 16 Apr 2019
* \endvar
*/
{ LFUN_PARAGRAPH_SELECT, "paragraph-select", ReadOnly, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_PARAGRAPH_UP_SELECT

View File

@ -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;
}
@ -3534,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: