1234567891011121314151617181920212223242526272829303132333435363738394041424344454647(* Claude Code
*
* Copyright (C) 2026 Yoann Padioleau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* (LGPL) as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*)(* See Document.mli *)(*****************************************************************************)(* Types *)(*****************************************************************************)type'at={content:'a;path:stringoption;(* the version last saved, kept so that "is it dirty?" is a
comparison and not a flag somebody has to remember to set *)saved:'a;equal:'a->'a->bool;}(*****************************************************************************)(* Functions *)(*****************************************************************************)letcreate?path?(equal=(==))content={content;path;saved=content;equal}letcontentt=t.contentletpatht=t.pathletwith_pathpatht={twithpath=Somepath}letputcontentt={twithcontent}leteditft={twithcontent=ft.content}letdirtyt=not(t.equalt.contentt.saved)letmark_savedt={twithsaved=t.content}lettitlet=letname=matcht.pathwith|None->"untitled"|Somep->(matchString.rindex_optp'/'with|None->p|Somei->String.subp(i+1)(String.lengthp-i-1))inifdirtytthenname^" *"elsename