Simplify the calculation when there are inline editors

@RaymondLim This is for PR #7118. I was waiting until you finished reviewing to make this change, but didnt had a change. Here it is.