Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

573 B
Raw Blame
export const CELL_PREVIEW_LIMIT = 1000;

/** Bound text layout without changing the underlying value or splitting a surrogate pair. */
export function cellPreview(value: string): string {
  if (value.length <= CELL_PREVIEW_LIMIT) return value;
  let end = CELL_PREVIEW_LIMIT;
  const last = value.charCodeAt(end - 1);
  if (last >= 0xd800 && last <= 0xdbff) end--;
  return value.slice(0, end) + "\u2026";
}

/** Whether the value spans several lines (a single-line field would drop its line breaks). */
export const hasLineBreak = (value: string) => /[\r\n]/.test(value);