Send more info on errors converting buffer positions to screen positions

We've gotten one rogue error but I have no idea how to reproduce it.
This will tell us if soft wrap is enabled and if any folds are present
so hopefully we can start narrowing these down.
This commit is contained in:
Nathan Sobo
2014-01-26 15:00:58 -07:00
parent b05e20245f
commit aec9e75ecb

View File

@@ -297,8 +297,12 @@ class DisplayBuffer extends Model
[startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row)
for screenRow in [startScreenRow...endScreenRow]
unless screenLine = @screenLines[screenRow]
throw new Error("No screen line exists for screen row #{screenRow}, converted from buffer position (#{row}, #{column})")
throw new Error """
No screen line exists for screen row #{screenRow}, converted from buffer position (#{row}, #{column})
Soft wrap enabled: #{@getSoftWrap()}
Fold count: #{@findFoldMarkers().length}
Last buffer row: #{@getLastRow()}
"""
maxBufferColumn = screenLine.getMaxBufferColumn()
if screenLine.isSoftWrapped() and column > maxBufferColumn
continue