Add proportional fonts, edit modes, and TOML config

- Add three proportional serif fonts: Crimson Pro, ET Book, Spectral
- Fix text rendering for variable-width fonts: selection, cursor,
  mouse click mapping, search highlights, and syntax-colored text
  now use pixel-accurate measurement via ImGui::CalcTextSize()
- Add per-buffer edit mode (code/writing) with auto-detection from
  file extension (.txt, .md, .rst, .org, .tex default to writing)
- Add C-k m keybinding and :mode command to toggle edit modes
- Switch config format from INI to TOML (kge.toml), with legacy
  INI fallback; vendor toml++ v3.4.0
- New config keys: font.code and font.writing for per-mode defaults
- Add font tab completion for ImGui builds
- Add tab completion for :mode command
- Update help text, themes.md, and add CONFIG.md
- Bump version to 1.10.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 23:05:56 -07:00
parent 0585edad9e
commit 23f04e4357
21 changed files with 24521 additions and 123 deletions

View File

@@ -1,5 +1,7 @@
/*
* GUIConfig - loads simple GUI configuration from $HOME/.config/kte/kge.ini
* GUIConfig - loads GUI configuration from $HOME/.config/kte/kge.toml
*
* Falls back to legacy kge.ini if no TOML config is found.
*/
#pragma once
@@ -22,12 +24,18 @@ public:
std::string background = "dark";
// Default syntax highlighting state for GUI (kge): on/off
// Accepts: on/off/true/false/yes/no/1/0 in the ini file.
bool syntax = true; // default: enabled
bool syntax = true;
// Load from default path: $HOME/.config/kte/kge.ini
// Per-mode font defaults
std::string code_font = "default";
std::string writing_font = "crimsonpro";
// Load from default paths: try kge.toml first, fall back to kge.ini
static GUIConfig Load();
// Load from explicit path. Returns true if file existed and was parsed.
bool LoadFromFile(const std::string &path);
// Load from explicit TOML path. Returns true if file existed and was parsed.
bool LoadFromTOML(const std::string &path);
// Load from explicit INI path (legacy). Returns true if file existed and was parsed.
bool LoadFromINI(const std::string &path);
};