Scroll and stop text on LCD

only print the X after you first print a space...

void loop() {
  static int i = 0;
  static int a = 0;             // move cursor to second line "1" and 9 spaces over
  //lcd.setCursor(i, a);
  //lcd.print("x");       // display seconds elapsed since power-up
  //lcd.print(adc_key_in);

  lcd_key = read_LCD_buttons();   // read the buttons

  switch (lcd_key) {              // depending on which button was pushed, we perform an action

    case btnRIGHT: {
        lcd.print(" ");
        lcd.setCursor(i++, a);
        lcd.print("x");
        break;
      }
    case btnLEFT: {
        lcd.print(" ");
        lcd.setCursor(i--, a);
        lcd.print("x");
        break;
      }
    case btnUP: {
        lcd.print(" ");
        lcd.setCursor(i, a++);
        lcd.print("x");
        break;
      }
    case btnDOWN: {
        lcd.print(" ");
        lcd.setCursor(i, a--);
        lcd.print("x");
        break;
      }

  }
}