@@ -198,12 +198,16 @@ impl EditorView {
198198
199199 // TODO: paint cursor heads except primary
200200
201− surface.set_string(
202− viewport.x + visual_x,
203− viewport.y + line,
204− grapheme,
205− style,
206− );
201+ // HAXX: we don't render the char if it's offscreen. This should be
202+ // skipped in a better way much earlier
203+ if visual_x < viewport.width {
204+ surface.set_string(
205+ viewport.x + visual_x,
206+ viewport.y + line,
207+ grapheme,
208+ style,
209+ );
210+ }
207211
208212 visual_x += width;
209213 }
@@ -268,12 +272,18 @@ impl EditorView {
268272
269273 if let Some(path) = doc.relative_path() {
270274 let path = path.to_string_lossy();
271− surface.set_string(viewport.x + 6, viewport.y, path, text_color);
275+ surface.set_stringn(
276+ viewport.x + 6,
277+ viewport.y,
278+ path,
279+ viewport.width.saturating_sub(6) as usize,
280+ text_color,
281+ );
272282 // TODO: append [+] if modified
273283 }
274284
275285 surface.set_string(
276− viewport.x + viewport.width - 10,
286+ viewport.x + viewport.width.saturating_sub(10),
277287 viewport.y,
278288 format!("{}", doc.diagnostics.len()),
279289 text_color,