When an item in your selected hotbar slot runs out after placing or consuming, it is automatically replaced with the same stackable item from your main inventory. Other hotbar slots and locked stacks are left alone.