Broke my code using PROGMEM

Morning,

I worked on through it, taking each block and working through it logically until i decided to create a function called "Buildmenu" and called it here -

 // Build the top level menu if select Switch is pressed
 if(digitalRead(enSW)==0){
    while(digitalRead(enSW)==0);//wait till switch is released.
    
    Buildmenu();
 }

When it runs I laid it out like this -

void Buildmenu(){
    
    int itemsPerScreen = 4;    
 int menuLength = 4;
 int curPos,startPos, endPos;
 do{ 
      
            startPos = encoderPos%menuLength;    
            display.clearDisplay();
      
            endPos = itemsPerScreen;
            
            if(menuLength < itemsPerScreen)
            {
                 endPos = menuLength -startPos;  
            }
      
            if((menuLength-startPos)<itemsPerScreen)
            {
                endPos = menuLength -startPos;
            }

      
            for(cnt = 0; cnt<=(endPos-1); cnt++){
                if(cnt == 0)
                {
                  display.setCursor(0,0);
                  display.print(F("Scroll to select"));
                  display.drawFastHLine(0,10,200,WHITE);
                  display.setCursor(0,16 +cnt*fontSize);// sets the selection pointer
                  display.print(F("->"));
                  display.setCursor(16,16 +cnt*fontSize);// sets the height of the submenu text
                }
                
                for(int i = 0; i < 4; i++){
                
                display.println((__FlashStringHelper*)menu_table[i]);
                
                }
                
                
            }
            
            display.display();
            cnt = 0;

          if(oldEncPos != encoderPos) {
            oldEncPos = encoderPos;   
          }  
 }while(digitalRead(enSW));
 while(digitalRead(enSW)==0); //wait till switch is reseleased 
 return startPos;

   
   
  
}

When it runs I see this on the screen -

-> Messaging
UV Scanner
Security
Main Menu
Messaging
UV Scanner

When I turn the encoder the bottom two items disappear and return alternating on clicks of the encoder?

The first line is offset by the cursor

subsequent lines are not, but I can't figure that out?

I am not too fussed about the layout of the screen provided that the selection of items depending on the encoder position can be sorted.

I have tried adjusting the values of:

cnt
i
menuLength
itemsPerScreen

But none of these seem to make much change

Hope this explains further.

Cheers b