mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 02:54:09 +00:00
Reimplement error-next (#2775)
This is often more convenient for checking errors than the dialog. At least if the errors are obvious. I re-introduce the binding this had up to LyX 1.4.
This commit is contained in:
parent
7f27eabada
commit
b6e4ba2548
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
!!!The following new LyX functions have been introduced in 2.5:
|
!!!The following new LyX functions have been introduced in 2.5:
|
||||||
|
|
||||||
|
- The re-introduced function error-next movers the cursor to the next
|
||||||
|
LaTeX error in the current buffer.
|
||||||
|
|
||||||
- The new function errors-show re-displays the (e.g., LaTeX) errors dialog
|
- The new function errors-show re-displays the (e.g., LaTeX) errors dialog
|
||||||
if there had been any processing errors.
|
if there had been any processing errors.
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ Format 5
|
|||||||
\bind "S-F6" "tab-group-previous"
|
\bind "S-F6" "tab-group-previous"
|
||||||
\bind "C-F6" "buffer-next"
|
\bind "C-F6" "buffer-next"
|
||||||
\bind "C-S-F6" "buffer-previous"
|
\bind "C-S-F6" "buffer-previous"
|
||||||
|
\bind "C-g" "error-next"
|
||||||
\bind "F7" "dialog-show spellchecker"
|
\bind "F7" "dialog-show spellchecker"
|
||||||
\bind "S-F7" "thesaurus-entry"
|
\bind "S-F7" "thesaurus-entry"
|
||||||
|
|
||||||
|
@ -605,6 +605,7 @@ Menuset
|
|||||||
#
|
#
|
||||||
Menu "navigate"
|
Menu "navigate"
|
||||||
Submenu "Bookmarks|B" "navigate_bookmarks"
|
Submenu "Bookmarks|B" "navigate_bookmarks"
|
||||||
|
Item "Next Error|E" "error-next"
|
||||||
Item "Next Note|N" "note-next"
|
Item "Next Note|N" "note-next"
|
||||||
Item "Next Change|C" "change-next"
|
Item "Next Change|C" "change-next"
|
||||||
Item "Next Cross-Reference|R" "reference-next"
|
Item "Next Cross-Reference|R" "reference-next"
|
||||||
|
@ -513,7 +513,8 @@ enum FuncCode
|
|||||||
// 400
|
// 400
|
||||||
LFUN_REFERENCE_TO_PARAGRAPH, // spitz, 20240728
|
LFUN_REFERENCE_TO_PARAGRAPH, // spitz, 20240728
|
||||||
LFUN_WORD_INVERTCASE, // lasgouttes 20241015
|
LFUN_WORD_INVERTCASE, // lasgouttes 20241015
|
||||||
LFUN_ERRORS_SHOW, // spitz 20241231
|
LFUN_ERRORS_SHOW, // spitz 20241231,
|
||||||
|
LFUN_ERROR_NEXT, // spitz 20200101,
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1588,6 +1588,14 @@ void LyXAction::init()
|
|||||||
*/
|
*/
|
||||||
{ LFUN_ERRORS_SHOW, "errors-show", NoBuffer, Edit },
|
{ LFUN_ERRORS_SHOW, "errors-show", NoBuffer, Edit },
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \var lyx::FuncCode lyx::LFUN_ERROR_NEXT
|
||||||
|
* \li Action: Moves the cursor to the beginning of next LaTeX error.
|
||||||
|
* \li Syntax: error-next
|
||||||
|
* \endvar
|
||||||
|
*/
|
||||||
|
{ LFUN_ERROR_NEXT, "error-next", ReadOnly, Edit },
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \var lyx::FuncCode lyx::LFUN_ERT_INSERT
|
* \var lyx::FuncCode lyx::LFUN_ERT_INSERT
|
||||||
* \li Action: Inserts an ERT inset.
|
* \li Action: Inserts an ERT inset.
|
||||||
|
@ -2192,6 +2192,35 @@ void GuiView::errors(string const & error_type, bool from_master)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiView::nextError(string const & error_type, bool from_master, bool testonly)
|
||||||
|
{
|
||||||
|
BufferView const * const bv = currentBufferView();
|
||||||
|
if (!bv)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Buffer const & buf = from_master
|
||||||
|
? *(bv->buffer().masterBuffer())
|
||||||
|
: bv->buffer();
|
||||||
|
|
||||||
|
ErrorList const & el = buf.errorList(error_type);
|
||||||
|
|
||||||
|
if (el.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (auto const & err : el) {
|
||||||
|
if (TexRow::isNone(err.start) || TexRow::getDocIteratorsFromEntries(err.start, err.end, buf).first <= bv->cursor())
|
||||||
|
continue;
|
||||||
|
if (testonly)
|
||||||
|
return true;
|
||||||
|
DispatchResult dr;
|
||||||
|
dispatch(TexRow::goToFunc(err.start, err.end), dr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::updateTocItem(string const & type, DocIterator const & dit)
|
void GuiView::updateTocItem(string const & type, DocIterator const & dit)
|
||||||
{
|
{
|
||||||
d.toc_models_.updateItem(toqstr(type), dit);
|
d.toc_models_.updateItem(toqstr(type), dit);
|
||||||
@ -2679,6 +2708,17 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_ERROR_NEXT: {
|
||||||
|
if (!buf || (buf->errorList(d.last_export_format).empty()
|
||||||
|
&& buf->masterBuffer()->errorList(d.last_export_format).empty())) {
|
||||||
|
enable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// We guess it's from master if the single buffer list is empty
|
||||||
|
bool const from_master = currentBufferView()->buffer().errorList(d.last_export_format).empty();
|
||||||
|
enable = nextError(d.last_export_format, from_master, true);
|
||||||
|
}
|
||||||
|
|
||||||
case LFUN_COMMAND_EXECUTE:
|
case LFUN_COMMAND_EXECUTE:
|
||||||
case LFUN_MESSAGE:
|
case LFUN_MESSAGE:
|
||||||
case LFUN_MENU_OPEN:
|
case LFUN_MENU_OPEN:
|
||||||
@ -4929,6 +4969,16 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_ERROR_NEXT: {
|
||||||
|
// We guess it's from master if the single buffer list is empty
|
||||||
|
bool const from_master = bv->buffer().errorList(d.last_export_format).empty();
|
||||||
|
if (nextError(d.last_export_format, from_master)) {
|
||||||
|
dr.forceBufferUpdate();
|
||||||
|
dr.screenUpdate(Update::Force);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LFUN_MESSAGE:
|
case LFUN_MESSAGE:
|
||||||
dr.setMessage(cmd.argument());
|
dr.setMessage(cmd.argument());
|
||||||
break;
|
break;
|
||||||
|
@ -177,6 +177,9 @@ public:
|
|||||||
void updateTocItem(std::string const &, DocIterator const &) override;
|
void updateTocItem(std::string const &, DocIterator const &) override;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/// move to next error
|
||||||
|
bool nextError(std::string const &, bool from_master = false, bool testonly = false);
|
||||||
|
|
||||||
///
|
///
|
||||||
TocModels & tocModels();
|
TocModels & tocModels();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user