(entryPtr)
| 1599 | * |
| 1600 | * EntryUpdateScrollbar -- |
| 1601 | * |
| 1602 | * This procedure is invoked whenever information has changed in |
| 1603 | * an entry in a way that would invalidate a scrollbar display. |
| 1604 | * If there is an associated scrollbar, then this command updates |
| 1605 | * it by invoking a Tcl command. |
| 1606 | * |
| 1607 | * Results: |
| 1608 | * None. |
| 1609 | * |
| 1610 | * Side effects: |
| 1611 | * A Tcl command is invoked, and an additional command may be |
| 1612 | * invoked to process errors in the command. |
| 1613 | * |
| 1614 | *---------------------------------------------------------------------- |
| 1615 | */ |
| 1616 | |
| 1617 | static void |
| 1618 | EntryUpdateScrollbar(entryPtr) |
| 1619 | register Entry *entryPtr; /* Information about widget. */ |
| 1620 | { |
| 1621 | char args[100]; |
| 1622 | int result, last, charsInWindow, endX; |
| 1623 | |
| 1624 | if (entryPtr->scrollCmd == NULL) { |
| 1625 | return; |
| 1626 | } |
| 1627 | |
| 1628 | /* |
| 1629 | * The most painful part here is guessing how many characters |
| 1630 | * actually fit in the window. This is only an estimate in the |
| 1631 | * case where the window isn't completely filled with characters. |
| 1632 | */ |
| 1633 | |
| 1634 | charsInWindow = TkMeasureChars(entryPtr->fontPtr, |
| 1635 | entryPtr->string + entryPtr->leftIndex, |
| 1636 | entryPtr->numChars - entryPtr->leftIndex, entryPtr->offset, |
| 1637 | Tk_Width(entryPtr->tkwin), |
| 1638 | TK_AT_LEAST_ONE|TK_NEWLINES_NOT_SPECIAL, &endX); |
| 1639 | if (charsInWindow == 0) { |
| 1640 | last = entryPtr->leftIndex; |
| 1641 | } else { |
| 1642 | last = entryPtr->leftIndex + charsInWindow - 1; |
no test coverage detected