Save char to Lcd screen help

I am trying to display a Name to an Lcd display, made up of an array of character letters to make the name.
Button 1= increments a letter in the character array.

Button2 = selects the array letter and moves the cursor forward into the next position for the next letter to make up a name, and puts it into a new word array.

Button 3 = Saves the new Name to the new word array.

here is my problem!
Button 4 = moves the cursor backward in order to edit any of the selected letters.
it does this, but it also deletes the letters in the Name when changing positions.

What I want it to do is to move the cursor backward to the position that needs the selected letter changed so I can edit the letter without changing the rest of the Name.

Any help would be great.

#include <LiquidCrystal.h>


// Button assignment and definitions
const int button[] = { 11, 12, 2, 3, A1, A0, A2 };
const int numButtons = sizeof(button) / sizeof(button[0]);
enum { B_SEL, B_INC, B_DEC, B_SAVE, B_READ, B_ENTER, R_back };

int lastButtonState[numButtons];

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);



const char* Editchars = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890,.!?&@#$%^*_-+=(){}[]<>|\\/'\"~";

char prgn[] = "              progr";
int selectIdx = 0;  
int columnIdx = 0; 
int wordIdx = 0;  
int Sync = 0;

int wordct = 0;

void setup()
{
  lcd.begin(16, 2);
  //lcd.print (output);
  Serial.begin(9600);

  for ( int i = 0; i < numButtons; ++i ) {
    pinMode (button[i], INPUT_PULLUP);
  }
}

void loop()
{
  int buttonState;

  //*******************Savetoarray,and move cursor***************
  buttonState = digitalRead(button[B_INC]);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState[B_INC]) {
    if (buttonState == LOW) {
      wordIdx++;

      prgn[wordIdx] = Editchars[selectIdx];
     

     columnIdx++;
      
      lcd.setCursor(columnIdx + 7, 0);
lcd.cursor();
      Serial.println("scroll");
     Serial.println(prgn);
      selectIdx = 0;
                 if (columnIdx > 5) columnIdx = 0;      
    }
  }
  lastButtonState[B_INC] = buttonState;

  //************** Char select***************************

  if (digitalRead(button[B_SEL]) == LOW) {
  
    
    
    selectIdx++;
    
       
    lcd.setCursor(columnIdx + 7, 0);

    lcd.print(Editchars[selectIdx]);
           lcd.setCursor(columnIdx + 7, 0);

    lcd.cursor();
    delay(50);
    
  }


  // *****************Increment character back*************************************
  buttonState = digitalRead(button[B_DEC]);
  if (buttonState != lastButtonState[B_DEC]) {
    if (buttonState == LOW) {
      selectIdx--;
      if (selectIdx < 1) selectIdx = 1;
      //lcd.cursor();
      lcd.setCursor(columnIdx + 7, 0);
      lcd.print(Editchars[selectIdx]);
      
    }
  }
  lastButtonState[B_DEC] = buttonState;

  //************************************

   buttonState = digitalRead(button[B_SAVE]);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState[B_SAVE]) {
    if (buttonState == LOW) {
     // selectIdx--;
wordIdx--;
     
      columnIdx--;
     
      lcd.setCursor(columnIdx + 7 , 0);
lcd.cursor();
   
      Serial.println("scroll");
      Serial.println(prgn);
selectIdx = 0;
      if (columnIdx < 1) columnIdx = 0;
      
    }
  }
  lastButtonState[B_SAVE] = buttonState;



  //************************reading from 
 buttonState = digitalRead(button[R_back]);
  if (buttonState != lastButtonState[R_back]) {
    if (buttonState == LOW) {
       prgn[wordIdx + 1] = '\0';
  Serial.print(prgn);
  }
  }
  lastButtonState[R_back] = buttonState;
}

It is confusing to me that you describe the desired behavior of 4 buttons (1-4), yet your code defines 7 buttons. What this the mapping from button 1..4 to B_SEL, B_INC, B_DEC, B_SAVE, B_READ, B_ENTER, R_back ?

Apologies, I have been trying to get this working all day.

Button1=B_SEL
Button2 = B_INC
Button3 = R_back
Button4 = B_SAVE

Thanks for the reply.

I Can get it to work on the lcd screen but it wont save it, the way it is on the screen.

That does not seem to align with your original descriptions of the buttons

The first step in any project is clearly describing the inputs/outputs

B_SEL = increments a letter forward in the character array.
B_INC = puts the character from B_SEL and saves that character to the new Name(prgn) and moves the cursor to the next position.
B_SAVE = moves the cursor backwards from the previous cursor position along the new name, deleting each character as it moves backwards
R_Back = Saves the new name to a new array and prints the new word to the serial monitor.

How do i get the cursor to move back through the new Name without deleting each position as the cursor moves back?

buttonState = digitalRead(button[B_SAVE]);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState[B_SAVE]) {
    if (buttonState == LOW) {
     // selectIdx--;
wordIdx--;
     
      columnIdx--;
     
      lcd.setCursor(columnIdx + 7 , 0);
lcd.cursor();
   
      Serial.println("scroll");
      Serial.println(prgn);
selectIdx = 0;
      if (columnIdx < 1) columnIdx = 0;
      
    }
  }
  lastButtonState[B_SAVE] = buttonState;