Rename
This commit is contained in:
1 parent
d44a3552c9
commit
d2e56dba4b
2 files changed
+16
-15
No files matched your search
+7
-6
@@ -95,7 +95,7 @@ struct TerminalUI {
|
||||
terminal: Terminal<CrosstermBackend<Stdout>>,
|
||||
terminal_state: TerminalState,
|
||||
event_handler: EventHandler,
|
||||
app_state: EditorCore,
|
||||
editor_core: EditorCore,
|
||||
}
|
||||
|
||||
impl TerminalUI {
|
||||
@@ -108,7 +108,7 @@ impl TerminalUI {
|
||||
terminal,
|
||||
event_handler: EventHandler::new(),
|
||||
terminal_state: TerminalState::new(),
|
||||
app_state: editor_core,
|
||||
editor_core,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,17 +146,18 @@ impl TerminalUI {
|
||||
KeyCode::Tab => Input::Tab,
|
||||
_ => Input::None,
|
||||
};
|
||||
self.app_state.send_input(action);
|
||||
self.editor_core.send_input(action);
|
||||
}
|
||||
}
|
||||
|
||||
self.app_state.process_commands();
|
||||
self.editor_core.process_commands();
|
||||
|
||||
while let Ok(()) = update_rx.try_recv() {
|
||||
self.terminal.draw(|mut frame| {
|
||||
self.terminal_state.render(&mut frame, &mut self.app_state)
|
||||
self.terminal_state
|
||||
.render(&mut frame, &mut self.editor_core)
|
||||
})?;
|
||||
if self.app_state.should_quit {
|
||||
if self.editor_core.should_quit {
|
||||
break 'outer;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -19,7 +19,7 @@ impl TerminalState {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn render(&mut self, frame: &mut Frame, app: &EditorCore) {
|
||||
pub(super) fn render(&mut self, frame: &mut Frame, core: &EditorCore) {
|
||||
let area = frame.size();
|
||||
|
||||
let layout = Layout::default()
|
||||
@@ -31,16 +31,16 @@ impl TerminalState {
|
||||
])
|
||||
.split(area);
|
||||
|
||||
let active_buffer = app.active_buffer();
|
||||
let active_buffer = core.active_buffer();
|
||||
let cursor = active_buffer.cursor_pos;
|
||||
|
||||
//frame.render_widget(Paragraph::new(text).white().on_black(), layout[0]);
|
||||
|
||||
self.render_main_buffers(frame, layout[0], app);
|
||||
self.render_main_buffers(frame, layout[0], core);
|
||||
|
||||
frame.render_widget(
|
||||
Paragraph::new(vec![Line::from(vec![
|
||||
format!("Mode: {:?} ", app.mode()).into(),
|
||||
format!("Mode: {:?} ", core.mode()).into(),
|
||||
Span::styled(
|
||||
format!("Cursor: {}", cursor),
|
||||
Style::default().fg(Color::Red),
|
||||
@@ -52,7 +52,7 @@ impl TerminalState {
|
||||
layout[1],
|
||||
);
|
||||
|
||||
self.render_command(frame, app, layout[2]);
|
||||
self.render_command(frame, core, layout[2]);
|
||||
}
|
||||
|
||||
fn render_main_buffers(&mut self, frame: &mut Frame, rect: Rect, core: &EditorCore) {
|
||||
@@ -143,8 +143,8 @@ impl TerminalState {
|
||||
}
|
||||
}
|
||||
|
||||
fn render_command(&mut self, frame: &mut Frame, app: &EditorCore, rect: Rect) {
|
||||
let line = if let Some(ref cmd) = app.current_command() {
|
||||
fn render_command(&mut self, frame: &mut Frame, core: &EditorCore, rect: Rect) {
|
||||
let line = if let Some(ref cmd) = core.current_command() {
|
||||
format!(":{cmd}").into()
|
||||
} else {
|
||||
"".into()
|
||||
@@ -156,11 +156,11 @@ impl TerminalState {
|
||||
|
||||
// Style computations
|
||||
|
||||
fn line_number_style(_app: &EditorCore) -> Style {
|
||||
fn line_number_style(_core: &EditorCore) -> Style {
|
||||
Style::default().fg(Color::Yellow)
|
||||
}
|
||||
|
||||
fn cursor_style(_app: &EditorCore) -> Style {
|
||||
fn cursor_style(_core: &EditorCore) -> Style {
|
||||
Style::default()
|
||||
.bg(Color::White)
|
||||
.add_modifier(Modifier::SLOW_BLINK)
|
||||
|
||||
Reference in new issue
Block a user