remove BufferPane::write_file() and handle writing from Window class
This commit is contained in:
parent
6779890ca9
commit
ee0d1e0d0e
@ -519,14 +519,6 @@ void BufferPane::kill_character_at_cursor()
|
||||
}
|
||||
}
|
||||
|
||||
void BufferPane::write_file()
|
||||
{
|
||||
if (m_buffer->filename())
|
||||
{
|
||||
m_buffer->write_to_file(m_buffer->filename()->c_str());
|
||||
}
|
||||
}
|
||||
|
||||
size_t BufferPane::display_column() const
|
||||
{
|
||||
if (!m_iterator->valid())
|
||||
|
@ -19,7 +19,6 @@ public:
|
||||
void insert_code_point(uint32_t code_point);
|
||||
void exit_insert_mode();
|
||||
void kill_character_at_cursor();
|
||||
void write_file();
|
||||
bool insert_mode() const { return m_buffer->insert_mode(); }
|
||||
void scroll_window_up(Window::ScrollMode scroll_mode);
|
||||
void scroll_window_down(Window::ScrollMode scroll_mode);
|
||||
@ -36,6 +35,7 @@ public:
|
||||
}
|
||||
void clear();
|
||||
int calculate_rows_in_line(const Buffer::Iterator & start_of_line);
|
||||
std::shared_ptr<Buffer> buffer() const { return m_buffer; }
|
||||
|
||||
protected:
|
||||
int effective_scroll_offset()
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "BufferPane.h"
|
||||
#include <iostream>
|
||||
#include "jes_icon-32x32.h"
|
||||
#include "CommandParser.h"
|
||||
|
||||
#define INITIAL_WIDTH 800
|
||||
#define INITIAL_HEIGHT 800
|
||||
@ -575,7 +574,7 @@ void Window::handle_command(const EncodedString & command)
|
||||
{
|
||||
if (cp[0] == "w")
|
||||
{
|
||||
m_focused_buffer_pane->write_file();
|
||||
command_write_file(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,3 +583,12 @@ void Window::handle_command(const EncodedString & command)
|
||||
/* TODO: handle command parsing failure */
|
||||
}
|
||||
}
|
||||
|
||||
void Window::command_write_file(const CommandParser & cp)
|
||||
{
|
||||
std::shared_ptr<Buffer> buffer = m_focused_buffer_pane->buffer();
|
||||
if (buffer->filename())
|
||||
{
|
||||
buffer->write_to_file(buffer->filename()->c_str());
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "Buffer.h"
|
||||
#include "GL.h"
|
||||
#include "EncodedString.h"
|
||||
#include "CommandParser.h"
|
||||
|
||||
class BufferPane;
|
||||
|
||||
@ -77,6 +78,8 @@ protected:
|
||||
void set_window_icon();
|
||||
void handle_command(const EncodedString & command);
|
||||
|
||||
void command_write_file(const CommandParser & cp);
|
||||
|
||||
SDL_Window * m_window;
|
||||
bool m_exit_requested;
|
||||
bool m_redraw_requested;
|
||||
|
Loading…
x
Reference in New Issue
Block a user