( frame: Frame, row: number, widthLimit: number, )
| 896 | } |
| 897 | |
| 898 | function rowFitsWithinWidth( |
| 899 | frame: Frame, |
| 900 | row: number, |
| 901 | widthLimit: number, |
| 902 | ): boolean { |
| 903 | if (row < 0 || row >= frame.screen.height) { |
| 904 | return true |
| 905 | } |
| 906 | |
| 907 | const { width, cells, charPool, hyperlinkPool } = frame.screen |
| 908 | const scanWidth = Math.min(width, frame.viewport.width) |
| 909 | const rowStart = row * width |
| 910 | let lastRenderedStyleId = -1 |
| 911 | const scratchCell: Cell = { |
| 912 | char: ' ', |
| 913 | styleId: 0, |
| 914 | width: CellWidth.Narrow, |
| 915 | hyperlink: undefined, |
| 916 | } |
| 917 | |
| 918 | for (let x = 0; x < scanWidth; x += 1) { |
| 919 | if ( |
| 920 | !visibleCellAtIndexInto( |
| 921 | cells, |
| 922 | charPool, |
| 923 | hyperlinkPool, |
| 924 | rowStart + x, |
| 925 | lastRenderedStyleId, |
| 926 | scratchCell, |
| 927 | ) |
| 928 | ) { |
| 929 | continue |
| 930 | } |
| 931 | const cell = scratchCell |
| 932 | const cellWidth = cell.width === CellWidth.Wide ? 2 : 1 |
| 933 | if (x + cellWidth > widthLimit) { |
| 934 | return false |
| 935 | } |
| 936 | lastRenderedStyleId = cell.styleId |
| 937 | } |
| 938 | |
| 939 | return true |
| 940 | } |
| 941 | |
| 942 | function rowLeavesRightMargin( |
| 943 | frame: Frame, |
no test coverage detected