Just as with in-cell edits, you press Enter to confirm your changes or Esc to cancel them. Or you can use the mouse: When you start tying in the formula bar, a checkmark and an "X" icon appear just to the left of the box where you're typing. Click the checkmark to confirm your entry, or "X" to roll it back.
Ordinarily, the formula bar's a single line. If you have a really long entry in a cell (like a paragraph's worth of text), you need to scroll from one side to the other. However, there's another option you can resize the formula bar so it fits more information, as shown in figure below.