mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Let Ctrl-Click on a reference jump to the corresponding label.
Fix some warnings while we're at it. (That part by RKH.)
This commit is contained in:
parent
35aaa1c528
commit
69841003a3
@ -124,6 +124,14 @@ void InsetRef::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ctrl + click: go to label
|
||||||
|
if (cmd.action() == LFUN_MOUSE_RELEASE && cmd.modifier() == ControlModifier) {
|
||||||
|
lyx::dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
|
||||||
|
lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getParam("reference")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise not for us
|
// otherwise not for us
|
||||||
if (pstring.empty())
|
if (pstring.empty())
|
||||||
return InsetCommand::doDispatch(cur, cmd);
|
return InsetCommand::doDispatch(cur, cmd);
|
||||||
@ -220,8 +228,8 @@ docstring InsetRef::getFormattedCmd(docstring const & ref,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure the prefix is legal for a latex command
|
// make sure the prefix is legal for a latex command
|
||||||
int const len = prefix.size();
|
size_t const len = prefix.size();
|
||||||
for (int i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
char_type const c = prefix[i];
|
char_type const c = prefix[i];
|
||||||
if (!isAlphaASCII(c)) {
|
if (!isAlphaASCII(c)) {
|
||||||
LYXERR0("Prefix `" << prefix << "' is invalid for LaTeX.");
|
LYXERR0("Prefix `" << prefix << "' is invalid for LaTeX.");
|
||||||
@ -303,7 +311,7 @@ int InsetRef::plaintext(odocstringstream & os,
|
|||||||
{
|
{
|
||||||
docstring const str = getParam("reference");
|
docstring const str = getParam("reference");
|
||||||
os << '[' << str << ']';
|
os << '[' << str << ']';
|
||||||
return 2 + str.size();
|
return 2 + int(str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -415,7 +423,7 @@ docstring InsetRef::xhtml(XMLStream & xs, OutputParams const & op) const
|
|||||||
void InsetRef::toString(odocstream & os) const
|
void InsetRef::toString(odocstream & os) const
|
||||||
{
|
{
|
||||||
odocstringstream ods;
|
odocstringstream ods;
|
||||||
plaintext(ods, OutputParams(0));
|
plaintext(ods, OutputParams(nullptr));
|
||||||
os << ods.str();
|
os << ods.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user