Refactor code for consistency and enhanced functionality.
- Normalize path handling for buffer operations, supporting tilde expansion and absolute paths. - Introduce `DisplayNameFor` to uniquely resolve buffer display names, minimizing filename clashes. - Add new commands: `ShowWorkingDirectory` and `ChangeWorkingDirectory`. - Refine keybindings and enhance existing commands for improved command flow. - Adjust GUI and terminal renderers to display total line counts alongside filenames. - Update coding style to align with project guidelines.
This commit is contained in:
7
Editor.h
7
Editor.h
@@ -302,7 +302,7 @@ public:
|
||||
|
||||
|
||||
// --- Generic Prompt subsystem (for search, open-file, save-as, etc.) ---
|
||||
enum class PromptKind { None = 0, Search, OpenFile, SaveAs, Confirm, BufferSwitch, GotoLine };
|
||||
enum class PromptKind { None = 0, Search, OpenFile, SaveAs, Confirm, BufferSwitch, GotoLine, Chdir };
|
||||
|
||||
|
||||
void StartPrompt(PromptKind kind, const std::string &label, const std::string &initial)
|
||||
@@ -409,6 +409,11 @@ public:
|
||||
|
||||
const Buffer *CurrentBuffer() const;
|
||||
|
||||
// Compute a display-friendly short name for a buffer path that is the
|
||||
// shortest unique suffix among all open buffers. If buffer has no name,
|
||||
// returns "[no name]".
|
||||
[[nodiscard]] std::string DisplayNameFor(const Buffer &buf) const;
|
||||
|
||||
// Add an existing buffer (copy/move) or open from file path
|
||||
std::size_t AddBuffer(const Buffer &buf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user