Improve code area selection from outside actual boundaries