mirror of
https://github.com/urbit/shrub.git
synced 2024-12-29 15:14:17 +03:00
clay: render syntax errors at end of file
Previously, if the pointer for a syntax error pointed to the end of the file (and the file ended in a newline) the code snippet rendering would try to display a line _beyond_ the end of the file, causing a crash. Here, we detect that case, and display `<<end of file>>` instead.
This commit is contained in:
parent
5b773723b3
commit
7a110db60d
@ -970,8 +970,14 @@
|
||||
%- mean %- flop
|
||||
=/ lyn p.hair
|
||||
=/ col q.hair
|
||||
^- (list tank)
|
||||
:~ leaf+"syntax error at [{<lyn>} {<col>}] in {<pax>}"
|
||||
leaf+(trip (snag (dec lyn) (to-wain:format (crip tex))))
|
||||
::
|
||||
=/ =wain (to-wain:format (crip tex))
|
||||
?: (gth lyn (lent wain))
|
||||
'<<end of file>>'
|
||||
(snag (dec lyn) wain)
|
||||
::
|
||||
leaf+(runt [(dec col) '-'] "^")
|
||||
==
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user