Skip to content

A shift brings one column per step and ends with the space behind its char - #151

Merged
theAndreas merged 2 commits into
mainfrom
shift-ends-with-its-space
Nov 18, 2026
Merged

theAndreas merged 2 commits into
mainfrom
shift-ends-with-its-space

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

What changes for a user

A char or a text that shifts in now moves one column per step, from the first step on. Each char brings the space behind it and no more, so chars shifted in one after another keep their distance. A text ends once the space behind its last char has come in.

Before, the shift did not keep what the reference promised: that the shift interval is the time per column, and that the last char ends at the right edge.

  • The first step of a char brought two of its columns at once.
  • The step that ended a char brought one more empty column.
  • The end of a text brought another.

"Hi" stopped with three empty columns at the right edge, a single char with two. Now each stops with the one space behind its last char, and the reference says so.

The moving examples change accordingly: in simavr, ScrollText and Messages show the same text one column behind at the same moment.

Why

OIL 41, the chapter Tests: rewriting the tests of other chain lengths, the first test that wrote the end of a shift down found that the code and the reference disagreed. As decided, a char brings its space and nothing more.

How it was checked

New tests, each failing before the fix:

  • a char brings one column per step;
  • a char ends with the space behind it;
  • a text ends with the space behind its last char.

The tests that pinned the old steps follow the new ones: the pace of a shift, the step count of a repeating text, and where a wide char ends. So do the expected panels of ScrollText and Messages, each looked at. make check passes, with coverage at 100 % of lines, branches and conditions, and every example in simavr.

Flash on the Uno, main → this branch, in bytes; RAM is unchanged:

Example bit banging SPI DEV_ERROR_DETECT
Messages 4018 → 3998 3934 → 3914 5196 → 5176
ScrollText 3870 → 3850 3792 → 3772 5048 → 5028
SerialControl 6642 → 6628 6554 → 6540 6824 → 6810
all others unchanged unchanged unchanged

A text now ends in a call that shifts nothing, after the step that brought its last space. Ending it in that step instead would have needed a second call of the function that reads the next char, which avr-gcc then kept out of line: 46 to 64 bytes more. Nothing touches the transfer code.

… char

The reference promises that a shifting char or text comes in until its
last char stands at the right edge, and gives the shift interval as the
time per column. The first step of a char brought two of its columns at
once, the step that ended a char one more empty column, and the end of a
text another: "Hi" stopped with three empty columns at the right edge, a
single char with two.

As decided, every char now comes in one column per step with the space
behind it and no more, so that chars shifted one after another keep
their distance; a text ends once the space behind its last char has come
in, in a call that shifts nothing. The reference says so.

Reading the next char in the step that ends a char instead ended a text
without that call, but avr-gcc kept the reading out of line for its
second caller, 46 to 64 bytes of flash; as built, the examples that
shift text are 14 to 20 bytes smaller.

The tests that pinned the old steps follow, the pace of a shift among
them, and the panels of ScrollText and Messages at their time in simavr,
each the same text one column behind. RightEdge() and ShiftUntilReady()
moved into the test support, as the tests of the text use them too.
@theAndreas
theAndreas merged commit 9bdd432 into main Nov 18, 2026
13 of 24 checks passed
@theAndreas
theAndreas deleted the shift-ends-with-its-space branch November 18, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants