Finish commenting GetPagedMessageInputLine #15

Open
opened 2023-01-23 18:54:41 +01:00 by zotan · 0 comments
Owner

Specifically

Lines 388 to 390 in f3372f3
var wraps = (absCursorPos - wrapOffsetPostI) / (bufferWidth - wrapOffsetPreI - wrapOffsetPostI); // black magic
var finalCursorPos = absCursorPos - bufferWidth + wrapOffsetPreI + wrapOffsetPostI * wraps; // respect the special case of the first page & add one post offset per wrap
finalCursorPos %= bufferWidth - wrapOffsetPreI; // make sure the final cursor position is within the acceptable range (between zero and bufWidth - wrapOffsetPreI)

(replace "black magic" with explanation of /why/ it works, verify that explanation of the other lines is correct)

Specifically https://git.ztn.sh/zotan/tgcli/src/commit/f3372f39e4271bd51de7c7521cc6b3c85402281e/tgcli/Util.cs#L388-L390 (replace "black magic" with explanation of /why/ it works, verify that explanation of the other lines is correct)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: zotan/tgcli#15
No description provided.