Use "Ctrl+A" After Run

How can I use Ctrl+A to highlight everything in my code

String typing = “”;
void setup() {

textSize(16);
fill(#12F9FF);
size(700, 900);
}

void draw() {
background(255, 255, 255);
text(typing, 20, 20);

}
void keyPressed() {
if (keyCode==8) {
typing = typing.substring(0, typing.length()-1);
} else if (keyCode !=16) {
typing = typing +key;
}else if (keyCode==65) //Help Here

//typing = typing +key;
print("key: "+key+“code: “+keyCode+”\n”);
}

You write an editor and you want to select the text you have written in your editor?

You first need something like the section that is selected.

Or maybe you mean how to read ctrl-a?

Here ctrl-a gets recognized and a boolean is set



String typing = "";
boolean cursorOn = true; 
boolean controlDown=false;
boolean selectallOn=false; 

void setup() {
  size(700, 900);

  textSize(16);
}

void draw() {
  background(255, 255, 255);
  fill(#12F9FF);
  text(typing+cursorLine(), 20, 20);
  fill(0);
  text("key: "+key+"code: "+keyCode+"\n"+controlDown, 
    13, height-32);

  if (selectallOn) {
    fill(#12F9FF);
    text("Select All  ", width-110, 65);
  }
}
void keyPressed() {
  if (key==CODED) {
    // Coded
    if (keyCode==CONTROL) {
      controlDown=true;
    } else if (keyCode==65&&controlDown) {
      // select all 
      selectallOn=true;
    }
  } 
  // -------------------------------
  else {
    // not CODED
    if (keyCode==65&&controlDown) {
      // select all 
      selectallOn=true;
    } else if (keyCode==BACKSPACE) { // code 8 
      // BACKSPACE
      if (typing.length()>0) {
        typing = typing.substring(0, typing.length()-1);
      }
    } else if (keyCode !=16) {
      typing = typing + key;
    }
    //
  } // not CODED
  //
}//func 

void keyReleased () {
  if (key==CODED) {
    // Coded
    if (keyCode==CONTROL) {
      controlDown=false;
    }
  }
}

String cursorLine() {
  if (frameCount%17==0) 
    cursorOn = ! cursorOn;
  if (cursorOn)
    return "|";
  else return "";
}//func  
//


NEW VERSION

here you can use ctrl-p to print to console



String typing = "";
boolean cursorOn = true; 
boolean controlDown=false;
boolean selectallOn=false; 

void setup() {
  size(700, 900);

  PFont pfont1=createFont("ARIAL", 16); 
  textFont(pfont1); 
  // textSize(16);
}

void draw() {
  background(255, 255, 255);

  textSize(16);
  if (selectallOn) 
    fill(0);
  else 
  fill(#12F9FF);
  text(typing+cursorLine(), 20, 20);

  fill(0);
  text("key: "+key+"; code: "
    +keyCode+"\nControl: "
    +controlDown, 
    13, height-32);

  otherTexts();
}

// --------------------------------------------------

void keyPressed() {
  if (key==CODED) {
    // Coded
    if (keyCode==CONTROL) {
      controlDown=true;
    } else if (keyCode==65&&controlDown) {
      // select all 
      selectallOn=true;
    }
  } 
  // -------------------------------
  else {
    // not CODED
    if (key==ESC) {
      key=0; 
      selectallOn=false;
    } else if (keyCode==65&&controlDown) {
      // select all 
      selectallOn=true;
    } else if (keyCode==80&&controlDown) {
      //  
      println(typing);
    } else if (keyCode==BACKSPACE) { // code 8 
      // BACKSPACE
      if (typing.length()>0) {
        typing = typing.substring(0, typing.length()-1);
      }
    } else if (keyCode !=16) {
      typing = typing + key;
    }
    //
  } // not CODED
  //
} //func 

void keyReleased () {
  if (key==CODED) {
    // Coded
    if (keyCode==CONTROL) {
      controlDown=false;
    }
  }
}

// ----------------------------------------------------------

void otherTexts() {
  noFill(); 
  stroke(0);
  rect(width-210-3, 165-3, 
    199+4, 55); 
  textSize(12);
  fill(0); 
  text("Keys: Backspace, Ctrl-A (select all, deselect with ESC), \nCtrl-P", 
    width-210, 165, 
    199, 900);

  if (selectallOn) {
    fill(0); 
    text("Select All", 
      width-110, 65);
  }
}

String cursorLine() {
  if (frameCount%17==0) 
    cursorOn = ! cursorOn;

  if (cursorOn)
    return "|";
  else return "";
}//func  
//