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
+2 -2
View File
@@ -21,7 +21,7 @@ private:
// horizontal scroll offset), cached per screen row. Scanning a very long
// line from column 0 on every frame made each redraw O(line length).
struct SkipCache {
const void *buf = nullptr;
std::uint64_t buf_id = 0; // Buffer::Id(); addresses get reused
std::uint64_t version = 0;
std::size_t row = 0;
std::size_t coloffs = 0;
@@ -34,7 +34,7 @@ private:
// Render column of the cursor, cached the same way.
struct CursorCache {
const void *buf = nullptr;
std::uint64_t buf_id = 0; // Buffer::Id(); addresses get reused
std::uint64_t version = 0;
std::size_t row = 0;
std::size_t cx = 0;