Skip to content

Commit

Permalink
Fix docToWindowRect fail for the last word of a line
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox committed Mar 30, 2015
1 parent b81a3c2 commit 57d4cca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,17 @@ void lua_pushLineRect(lua_State *L, int left, int top, int right, int bottom, in
void docToWindowRect(LVDocView *tv, lvRect &rc) {
lvPoint topLeft = rc.topLeft();
lvPoint bottomRight = rc.bottomRight();
if (tv->docToWindowPoint(topLeft) && tv->docToWindowPoint(bottomRight)) {
if (tv->docToWindowPoint(topLeft)) {
rc.setTopLeft(topLeft);
}
if (tv->docToWindowPoint(bottomRight)) {
rc.setBottomRight(bottomRight);
} else {
// workaround to a bug in docToWindowPoint that has one pixel overflow
bottomRight.x -= 2;
if (tv->docToWindowPoint(bottomRight)) {
rc.setBottomRight(bottomRight);
}
}
}

Expand Down

0 comments on commit 57d4cca

Please sign in to comment.