|| getInsetByCode<InsetRef>(cur, REF_CODE));
break;
- case LFUN_CHANGES_TRACK:
- flag.setEnabled(true);
- flag.setOnOff(buffer_.params().track_changes);
- break;
-
- case LFUN_CHANGES_OUTPUT:
- flag.setEnabled(true);
- flag.setOnOff(buffer_.params().output_changes);
- break;
-
case LFUN_CHANGES_MERGE:
case LFUN_CHANGE_NEXT:
case LFUN_CHANGE_PREVIOUS:
flag.setEnabled(true);
break;
- case LFUN_BUFFER_TOGGLE_COMPRESSION: {
- flag.setOnOff(buffer_.params().compressed);
- break;
- }
-
- case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC: {
- flag.setOnOff(buffer_.params().output_sync);
- break;
- }
-
case LFUN_SCREEN_UP:
case LFUN_SCREEN_DOWN:
case LFUN_SCROLL:
break;
}
- case LFUN_CHANGES_TRACK:
- buffer_.params().track_changes = !buffer_.params().track_changes;
- break;
-
- case LFUN_CHANGES_OUTPUT:
- buffer_.params().output_changes = !buffer_.params().output_changes;
- if (buffer_.params().output_changes) {
- bool dvipost = LaTeXFeatures::isAvailable("dvipost");
- bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
- LaTeXFeatures::isAvailable("xcolor");
-
- if (!dvipost && !xcolorulem) {
- Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output, "
- "because neither dvipost nor xcolor/ulem are installed.\n"
- "Please install these packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
- } else if (!xcolorulem) {
- Alert::warning(_("Changes not shown in LaTeX output"),
- _("Changes will not be highlighted in LaTeX output "
- "when using pdflatex, because xcolor and ulem are not installed.\n"
- "Please install both packages or redefine "
- "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
- }
- }
- break;
-
case LFUN_CHANGE_NEXT:
findNextChange(this);
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
}
break;
- case LFUN_BUFFER_TOGGLE_COMPRESSION:
- // turn compression on/off
- buffer_.params().compressed = !buffer_.params().compressed;
- break;
-
- case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC:
- buffer_.params().output_sync = !buffer_.params().output_sync;
- break;
-
case LFUN_SCREEN_UP:
case LFUN_SCREEN_DOWN: {
Point p = getPos(cur);
cur.pit() = cur.lastpit();
cur.pos() = cur.lastpos();
}
+ cur.setCurrentFont();
dr.screenUpdate(Update::Force);
break;
// Horizontal scroll offset of the cursor row in pixels
int offset = d->horiz_scroll_offset_;
- int const MARGIN = 2 * theFontMetrics(d->cursor_.real_current_font).em();
- //lyxerr << "cur_x=" << cur_x << ", offset=" << offset << ", margin=" << MARGIN << endl;
- if (cur_x < offset + MARGIN) {
- // scroll right
- offset = cur_x - MARGIN;
- } else if (cur_x > offset + workWidth() - MARGIN) {
- // scroll left
- offset = cur_x - workWidth() + MARGIN;
+ int const MARGIN = 2 * theFontMetrics(d->cursor_.real_current_font).em()
+ + row.right_margin;
+ if (row.right_x() <= workWidth() - row.right_margin) {
+ // Row is narrower than the work area, no offset needed.
+ offset = 0;
+ } else {
+ if (cur_x - offset < MARGIN) {
+ // cursor would be too far right
+ offset = cur_x - MARGIN;
+ } else if (cur_x - offset > workWidth() - MARGIN) {
+ // cursor would be too far left
+ offset = cur_x - workWidth() + MARGIN;
+ }
+ // Correct the offset to make sure that we do not scroll too much
+ if (offset < 0)
+ offset = 0;
+ if (row.right_x() - offset < workWidth() - row.right_margin)
+ offset = row.right_x() - workWidth() + row.right_margin;
}
- if (offset < row.left_margin || row.width() <= workWidth())
- offset = 0;
+ //lyxerr << "cur_x=" << cur_x << ", offset=" << offset << ", row.wid=" << row.width() << ", margin=" << MARGIN << endl;
if (offset != d->horiz_scroll_offset_)
LYXERR(Debug::PAINTING, "Horiz. scroll offset changed from "