implement new lfuns inset-begin/end and their -select versions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-03-16 13:33:27 +00:00
parent 126be0a7c0
commit c7a08d57ce
4 changed files with 78 additions and 1 deletions

View File

@ -128,6 +128,8 @@
\bind "C-Down" "paragraph-down" \bind "C-Down" "paragraph-down"
\bind "C-Home" "buffer-begin" \bind "C-Home" "buffer-begin"
\bind "C-End" "buffer-end" \bind "C-End" "buffer-end"
\bind "M-C-Home" "inset-begin"
\bind "M-C-End" "inset-end"
\bind "C-~S-greater" "label-goto" \bind "C-~S-greater" "label-goto"
\bind "C-~S-less" "bookmark-goto 0" \bind "C-~S-less" "bookmark-goto 0"
@ -151,6 +153,8 @@
\bind "S-Next" "screen-down-select" \bind "S-Next" "screen-down-select"
\bind "S-C-Home" "buffer-begin-select" \bind "S-C-Home" "buffer-begin-select"
\bind "S-C-End" "buffer-end-select" \bind "S-C-End" "buffer-end-select"
\bind "S-M-C-Home" "inset-begin-select"
\bind "S-M-C-End" "inset-end-select"
\bind "C-Insert" "copy" \bind "C-Insert" "copy"
\bind "S-Insert" "paste" \bind "S-Insert" "paste"
\bind "S-Delete" "cut" \bind "S-Delete" "cut"

View File

@ -418,6 +418,12 @@ enum FuncCode
LFUN_VC_COMMAND, LFUN_VC_COMMAND,
LFUN_MATH_FONT_STYLE, LFUN_MATH_FONT_STYLE,
LFUN_PHANTOM_INSERT, // uwestoehr, 20090130 LFUN_PHANTOM_INSERT, // uwestoehr, 20090130
LFUN_INSET_BEGIN, // JMarc, 20090316
// 325
LFUN_INSET_END, // JMarc, 20090316
LFUN_INSET_BEGIN_SELECT, // JMarc, 20090316
LFUN_INSET_END_SELECT, // JMarc, 20090316
LFUN_LASTACTION // end of the table LFUN_LASTACTION // end of the table
}; };

View File

@ -1009,6 +1009,49 @@ void LyXAction::init()
*/ */
{ LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit }, { LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_INSET_BEGIN
* \li Action: Move the cursor to the beginning of the current inset
if it is not already there, or at the beginning of the
enclosing inset otherwise
* \li Syntax: inset-begin
* \li Origin: JMarc, 2009/03/16
* \endvar
*/
{ LFUN_INSET_BEGIN, "inset-begin", ReadOnly, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_INSET_BEGIN_SELECT
* \li Action: Move the cursor to the beginning of the current inset
if it is not already there, or at the beginning of the
enclosing inset otherwise (adding the
traversed text to the selection).
* \li Syntax: inset-begin-select
* \li Origin: JMarc, 2009/03/16
* \endvar
*/
{ LFUN_INSET_BEGIN_SELECT, "inset-begin-select", ReadOnly, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_INSET_END
* \li Action: Move the cursor to the end of the current inset
if it is not already there, or at the end of the
enclosing inset otherwise
* \li Syntax: inset-end
* \li Origin: JMarc, 2009/03/16
* \endvar
*/
{ LFUN_INSET_END, "inset-end", ReadOnly, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_INSET_END_SELECT
* \li Action: Move the cursor to the end of the current inset
if it is not already there, or at the end of the
enclosing inset otherwise (adding the
traversed text to the selection).
* \li Syntax: inset-end-select
* \li Origin: JMarc, 2009/03/16
* \endvar
*/
{ LFUN_INSET_END_SELECT, "inset-end-select", ReadOnly, Edit },
/*! /*!
* \var lyx::FuncCode lyx::LFUN_LINE_BEGIN * \var lyx::FuncCode lyx::LFUN_LINE_BEGIN
* \li Action: Move the cursor to the begining of the (screen) line. * \li Action: Move the cursor to the begining of the (screen) line.

View File

@ -561,6 +561,26 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
cur.updateFlags(Update::FitCursor); cur.updateFlags(Update::FitCursor);
break; break;
case LFUN_INSET_BEGIN:
case LFUN_INSET_BEGIN_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_INSET_BEGIN_SELECT);
if (cur.depth() == 1 || cur.pos() > 0)
needsUpdate |= cursorTop(cur);
else
cur.undispatched();
cur.updateFlags(Update::FitCursor);
break;
case LFUN_INSET_END:
case LFUN_INSET_END_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_INSET_END_SELECT);
if (cur.depth() == 1 || cur.pos() < cur.lastpos())
needsUpdate |= cursorBottom(cur);
else
cur.undispatched();
cur.updateFlags(Update::FitCursor);
break;
case LFUN_CHAR_FORWARD: case LFUN_CHAR_FORWARD:
case LFUN_CHAR_FORWARD_SELECT: case LFUN_CHAR_FORWARD_SELECT:
//LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur); //LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
@ -2378,10 +2398,14 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_PARAGRAPH_PARAMS_APPLY: case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_PARAMS: case LFUN_PARAGRAPH_PARAMS:
case LFUN_ESCAPE: case LFUN_ESCAPE:
case LFUN_BUFFER_END:
case LFUN_BUFFER_BEGIN: case LFUN_BUFFER_BEGIN:
case LFUN_BUFFER_END:
case LFUN_BUFFER_BEGIN_SELECT: case LFUN_BUFFER_BEGIN_SELECT:
case LFUN_BUFFER_END_SELECT: case LFUN_BUFFER_END_SELECT:
case LFUN_INSET_BEGIN:
case LFUN_INSET_END:
case LFUN_INSET_BEGIN_SELECT:
case LFUN_INSET_END_SELECT:
case LFUN_UNICODE_INSERT: case LFUN_UNICODE_INSERT:
// these are handled in our dispatch() // these are handled in our dispatch()
enable = true; enable = true;