summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 4063503f..b9aa551f 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1533,18 +1533,25 @@ static const int homeRowKeys_[] = {
1533static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) { 1533static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
1534 iWidget *w = as_Widget(d); 1534 iWidget *w = as_Widget(d);
1535 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed")) { 1535 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed")) {
1536 const iGmRun *mid = middleRun_DocumentWidget_(d); 1536 const iBool isHorizontalOnly =
1537 const char *midLoc = (mid ? mid->text.start : NULL); 1537 argLabel_Command(cmd, "horiz") != 0 && !argLabel_Command(cmd, "vert");
1538 /* Alt/Option key may be involved in window size changes. */ 1538 /* Alt/Option key may be involved in window size changes. */
1539 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse); 1539 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse);
1540 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); 1540 if (isHorizontalOnly) {
1541 scroll_DocumentWidget_(d, 0); 1541 const iGmRun *mid = middleRun_DocumentWidget_(d);
1542 if (midLoc) { 1542 const char *midLoc = (mid ? mid->text.start : NULL);
1543 mid = findRunAtLoc_GmDocument(d->doc, midLoc); 1543 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d));
1544 if (mid) { 1544 scroll_DocumentWidget_(d, 0);
1545 scrollTo_DocumentWidget_(d, mid_Rect(mid->bounds).y, iTrue); 1545 if (midLoc) {
1546 mid = findRunAtLoc_GmDocument(d->doc, midLoc);
1547 if (mid) {
1548 scrollTo_DocumentWidget_(d, mid_Rect(mid->bounds).y, iTrue);
1549 }
1546 } 1550 }
1547 } 1551 }
1552 else {
1553 scroll_DocumentWidget_(d, 0); /* prevent overscroll */
1554 }
1548 updateSideIconBuf_DocumentWidget_(d); 1555 updateSideIconBuf_DocumentWidget_(d);
1549 updateOutline_DocumentWidget_(d); 1556 updateOutline_DocumentWidget_(d);
1550 invalidate_DocumentWidget_(d); 1557 invalidate_DocumentWidget_(d);