colors
This commit is contained in:
@@ -37,8 +37,6 @@ impl Widget for &App {
|
|||||||
x2 += 1;
|
x2 += 1;
|
||||||
y2 += 1;
|
y2 += 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if x >= x1 && x <= x2{
|
if x >= x1 && x <= x2{
|
||||||
// in-between the Xs
|
// in-between the Xs
|
||||||
if y >= y1 && y <= y2 {
|
if y >= y1 && y <= y2 {
|
||||||
@@ -172,7 +170,10 @@ impl App {
|
|||||||
|
|
||||||
let bottom_split = Layout::default()
|
let bottom_split = Layout::default()
|
||||||
.direction(layout::Direction::Horizontal)
|
.direction(layout::Direction::Horizontal)
|
||||||
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
|
.constraints([
|
||||||
|
Constraint::Min(30),
|
||||||
|
Constraint::Min(100),
|
||||||
|
])
|
||||||
.split(cmd_line);
|
.split(cmd_line);
|
||||||
|
|
||||||
let cmd_line_left = bottom_split[0];
|
let cmd_line_left = bottom_split[0];
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::Rect,
|
layout::Rect, prelude, style::{Color, Modifier, Style}, widgets::{Paragraph, Widget}
|
||||||
prelude,
|
|
||||||
widgets::{Paragraph, Widget},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::app::{self, app::App};
|
use crate::app::{app::App};
|
||||||
|
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
Insert(Editor),
|
Insert(Editor),
|
||||||
@@ -18,7 +16,19 @@ pub enum Mode {
|
|||||||
|
|
||||||
impl Widget for &Mode {
|
impl Widget for &Mode {
|
||||||
fn render(self, area: Rect, buf: &mut prelude::Buffer) {
|
fn render(self, area: Rect, buf: &mut prelude::Buffer) {
|
||||||
Paragraph::new(self.to_string()).render(area, buf);
|
let style = match self {
|
||||||
|
// Where you are typing - italic
|
||||||
|
Mode::Insert(_) => Style::new().fg(Color::Blue).add_modifier(Modifier::ITALIC),
|
||||||
|
Mode::Command(_) => Style::new().fg(Color::LightGreen).add_modifier(Modifier::ITALIC),
|
||||||
|
Mode::Chord(_) => Style::new().fg(Color::Blue).add_modifier(Modifier::ITALIC),
|
||||||
|
// Movement-based modes
|
||||||
|
Mode::Visual(_) => Style::new().fg(Color::Yellow),
|
||||||
|
Mode::Normal => Style::new().fg(Color::Green),
|
||||||
|
};
|
||||||
|
|
||||||
|
Paragraph::new(self.to_string())
|
||||||
|
.style(style)
|
||||||
|
.render(area, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +153,7 @@ pub struct Editor {
|
|||||||
cursor: usize,
|
cursor: usize,
|
||||||
pub location: (usize, usize),
|
pub location: (usize, usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Editor {
|
impl Editor {
|
||||||
fn new(value: String, loc: (usize, usize)) -> Self {
|
fn new(value: String, loc: (usize, usize)) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user