Force a UTF-8 ctype, stable buffer ids, redraw after deferred opens

- main: when the environment's locale is not UTF-8 (LANG unset, C/POSIX),
  switch LC_CTYPE to a UTF-8 locale so ncurses delivers and draws
  multibyte characters instead of dropping them.
- Buffer::Id(): a process-unique id that survives moves and is fresh for
  copies. The terminal renderer's skip and cursor caches and the reload
  confirmation now key on it rather than the buffer's address, which is
  reused after a buffer is closed.
- The reload confirmation is cancelled by any other command, like the
  quit confirmation.
- TerminalFrontend redraws when a deferred open starts a prompt or sets a
  status (e.g. the swap recovery question), not only when a buffer opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
Claude
2026-09-24 09:16:04 -07:00
committed by Kyle Isom
parent 91ceb9bb01
commit 93901928da
8 changed files with 119 additions and 14 deletions
+3
View File
@@ -390,6 +390,7 @@ Buffer::operator=(const Buffer &other)
filename_ = other.filename_;
is_file_backed_ = other.is_file_backed_;
is_virtual_ = other.is_virtual_;
id_ = NextBufferId(); // a copy is a different document
dirty_ = other.dirty_;
read_only_ = other.read_only_;
mark_set_ = other.mark_set_;
@@ -436,6 +437,7 @@ Buffer::Buffer(Buffer &&other) noexcept
filename_(std::move(other.filename_)),
is_file_backed_(other.is_file_backed_),
is_virtual_(other.is_virtual_),
id_(other.id_),
dirty_(other.dirty_),
read_only_(other.read_only_),
mark_set_(other.mark_set_),
@@ -487,6 +489,7 @@ Buffer::operator=(Buffer &&other) noexcept
filename_ = std::move(other.filename_);
is_file_backed_ = other.is_file_backed_;
is_virtual_ = other.is_virtual_;
id_ = other.id_;
dirty_ = other.dirty_;
read_only_ = other.read_only_;
mark_set_ = other.mark_set_;