summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-10 11:26:42 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-10 11:27:04 +0200
commitc0dab13571bc79d2171fec1d4f507c5560f4d881 (patch)
tree83ef0c6f6697ab0b40bcd903e8336c413ce8e5d2 /src/ui/documentwidget.c
parent1c72027ba0880c30e9d8d382869798136c493f76 (diff)
Window: Keep scroll position when resizing vertically
Fixed broken logic. IssueID #138
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index b9aa551f..e35892cf 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1533,11 +1533,14 @@ 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 iBool isHorizontalOnly = 1536 const iBool isVerticalOnly =
1537 argLabel_Command(cmd, "horiz") != 0 && !argLabel_Command(cmd, "vert"); 1537 !argLabel_Command(cmd, "horiz") && 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 if (isHorizontalOnly) { 1540 if (isVerticalOnly) {
1541 scroll_DocumentWidget_(d, 0); /* prevent overscroll */
1542 }
1543 else {
1541 const iGmRun *mid = middleRun_DocumentWidget_(d); 1544 const iGmRun *mid = middleRun_DocumentWidget_(d);
1542 const char *midLoc = (mid ? mid->text.start : NULL); 1545 const char *midLoc = (mid ? mid->text.start : NULL);
1543 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); 1546 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d));
@@ -1549,9 +1552,6 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1549 } 1552 }
1550 } 1553 }
1551 } 1554 }
1552 else {
1553 scroll_DocumentWidget_(d, 0); /* prevent overscroll */
1554 }
1555 updateSideIconBuf_DocumentWidget_(d); 1555 updateSideIconBuf_DocumentWidget_(d);
1556 updateOutline_DocumentWidget_(d); 1556 updateOutline_DocumentWidget_(d);
1557 invalidate_DocumentWidget_(d); 1557 invalidate_DocumentWidget_(d);