Update buffer display names after changing working directory
Fixes #501
This commit is contained in:
parent
c71d0e9f8d
commit
7335065d20
|
@ -135,6 +135,12 @@ bool Buffer::set_name(String name)
|
|||
return false;
|
||||
}
|
||||
|
||||
void Buffer::update_display_name()
|
||||
{
|
||||
if (m_flags & Flags::File)
|
||||
m_display_name = compact_path(m_name);
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at(ByteCoord coord) const
|
||||
{
|
||||
return is_end(coord) ? end() : BufferIterator(*this, clamp(coord));
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
Flags& flags() { return m_flags; }
|
||||
|
||||
bool set_name(String name);
|
||||
void update_display_name();
|
||||
|
||||
BufferIterator insert(const BufferIterator& pos, StringView content);
|
||||
BufferIterator erase(BufferIterator begin, BufferIterator end);
|
||||
|
|
|
@ -1696,6 +1696,8 @@ const CommandDesc change_working_directory_cmd = {
|
|||
{
|
||||
if (chdir(parse_filename(parser[0]).c_str()) != 0)
|
||||
throw runtime_error(format("cannot change to directory '{}'", parser[0]));
|
||||
for (auto& buffer : BufferManager::instance())
|
||||
buffer->update_display_name();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user