TUI #1
@ -1,10 +1,10 @@
|
|||||||
|
use anyhow::Result;
|
||||||
use cxx_qt_lib::QString;
|
use cxx_qt_lib::QString;
|
||||||
use std::error::Error;
|
|
||||||
|
|
||||||
pub mod colors;
|
pub mod colors;
|
||||||
pub mod filesystem;
|
pub mod filesystem;
|
||||||
|
|
||||||
pub fn run(root_path: std::path::PathBuf) -> Result<(), Box<dyn Error>> {
|
pub fn run(root_path: std::path::PathBuf) -> Result<()> {
|
||||||
println!("Starting the GUI editor at {:?}", root_path);
|
println!("Starting the GUI editor at {:?}", root_path);
|
||||||
|
|
||||||
use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl};
|
use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl};
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
// TODO: Header
|
use anyhow::Result;
|
||||||
|
|
||||||
use std::error::Error;
|
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
@ -25,7 +23,7 @@ struct Cli {
|
|||||||
pub gui: bool,
|
pub gui: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<()> {
|
||||||
let args = Cli::from_args();
|
let args = Cli::from_args();
|
||||||
|
|
||||||
let root_path = match args.path {
|
let root_path = match args.path {
|
||||||
|
|||||||
@ -65,8 +65,16 @@ impl<'a> App<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn draw_tabs(&self, area: Rect, buf: &mut Buffer) {
|
fn draw_tabs(&self, area: Rect, buf: &mut Buffer) {
|
||||||
// TODO: Tabs should be opened from file explorer
|
// Determine the tab title from the current file (or use a fallback).
|
||||||
Tabs::new(["file.md", "file.cpp"])
|
let title = self
|
||||||
|
.editor
|
||||||
|
.file_path
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|p| p.file_name())
|
||||||
|
.and_then(|s| s.to_str())
|
||||||
|
.unwrap_or("Untitled");
|
||||||
|
|
||||||
|
Tabs::new(vec![title])
|
||||||
.divider(symbols::DOT)
|
.divider(symbols::DOT)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user