diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 72867133..341da6f8 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1493,8 +1493,12 @@ static const int homeRowKeys_[] = { | |||
1493 | 't', 'y', | 1493 | 't', 'y', |
1494 | }; | 1494 | }; |
1495 | 1495 | ||
1496 | static void updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumentWidget *d, | 1496 | static iBool updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocumentWidget *d, |
1497 | iBool keepCenter) { | 1497 | iBool keepCenter) { |
1498 | const int newWidth = documentWidth_DocumentWidget_(d); | ||
1499 | if (newWidth == size_GmDocument(d->doc).x) { | ||
1500 | return iFalse; /* hasn't changed */ | ||
1501 | } | ||
1498 | /* Font changes (i.e., zooming) will keep the view centered, otherwise keep the top | 1502 | /* Font changes (i.e., zooming) will keep the view centered, otherwise keep the top |
1499 | of the visible area fixed. */ | 1503 | of the visible area fixed. */ |
1500 | const iGmRun *run = keepCenter ? middleRun_DocumentWidget_(d) : d->firstVisibleRun; | 1504 | const iGmRun *run = keepCenter ? middleRun_DocumentWidget_(d) : d->firstVisibleRun; |
@@ -1505,7 +1509,7 @@ static void updateDocumentWidthRetainingScrollPosition_DocumentWidget_(iDocument | |||
1505 | /* TODO: First *fully* visible run? */ | 1509 | /* TODO: First *fully* visible run? */ |
1506 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); | 1510 | voffset = visibleRange_DocumentWidget_(d).start - top_Rect(run->visBounds); |
1507 | } | 1511 | } |
1508 | setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); | 1512 | setWidth_GmDocument(d->doc, newWidth); |
1509 | documentRunsInvalidated_DocumentWidget_(d); | 1513 | documentRunsInvalidated_DocumentWidget_(d); |
1510 | if (runLoc && !keepCenter) { | 1514 | if (runLoc && !keepCenter) { |
1511 | run = findRunAtLoc_GmDocument(d->doc, runLoc); | 1515 | run = findRunAtLoc_GmDocument(d->doc, runLoc); |