Skip to content

Commit

Permalink
Vendor ratatui temporarily
Browse files Browse the repository at this point in the history
Once ratatui/ratatui#114 has been merged,
we can undo this! But otherwise we can't publish to crates.io with a git
dependency.
  • Loading branch information
ellie committed Mar 31, 2023
1 parent 3552c7e commit 5a7fdef
Show file tree
Hide file tree
Showing 39 changed files with 14,533 additions and 21 deletions.
16 changes: 3 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ semver = "1.0.14"
runtime-format = "0.1.2"
tiny-bip39 = "1"
futures-util = "0.3"
ratatui = "0.20.1"
fuzzy-matcher = "0.3.7"
colored = "2.0.0"

# ratatui
bitflags = "1.3"
cassowary = "0.3"
unicode-segmentation = "1.2"

[dependencies.tracing-subscriber]
version = "0.3"
default-features = false
features = ["ansi", "fmt", "registry", "env-filter"]
optional = true

[patch.crates-io]
ratatui = { git = "https://github.com/conradludgate/tui-rs-revival", branch = "inline" }
4 changes: 2 additions & 2 deletions src/command/client/search/history_list.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::time::Duration;

use atuin_client::history::History;
use ratatui::{
use crate::ratatui::{
buffer::Buffer,
layout::Rect,
style::{Color, Modifier, Style},
widgets::{Block, StatefulWidget, Widget},
};
use atuin_client::history::History;

use super::format_duration;

Expand Down
4 changes: 2 additions & 2 deletions src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use super::{
engines::{SearchEngine, SearchState},
history_list::{HistoryList, ListState, PREFIX_LENGTH},
};
use crate::{command::client::search::engines, VERSION};
use ratatui::{
use crate::ratatui::{
backend::{Backend, CrosstermBackend},
layout::{Alignment, Constraint, Direction, Layout},
style::{Color, Modifier, Style},
text::{Span, Spans, Text},
widgets::{Block, BorderType, Borders, Paragraph},
Frame, Terminal, TerminalOptions, Viewport,
};
use crate::{command::client::search::engines, VERSION};

const RETURN_ORIGINAL: usize = usize::MAX;
const RETURN_QUERY: usize = usize::MAX - 1;
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use eyre::Result;

use command::AtuinCmd;
mod command;
mod ratatui;

const VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down
60 changes: 60 additions & 0 deletions src/ratatui/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: Bug report
about: Create an issue about a bug you encountered
title: ''
labels: bug
assignees: ''
---

<!--
Hi there, sorry `ratatui` is not working as expected.
Please fill this bug report conscientiously.
A detailed and complete issue is more likely to be processed quickly.
-->

## Description
<!--
A clear and concise description of what the bug is.
-->


## To Reproduce
<!--
Try to reduce the issue to a simple code sample exhibiting the problem.
Ideally, fork the project and add a test or an example.
-->


## Expected behavior
<!--
A clear and concise description of what you expected to happen.
-->


## Screenshots
<!--
If applicable, add screenshots, gifs or videos to help explain your problem.
-->


## Environment
<!--
Add a description of the systems where you are observing the issue. For example:
- OS: Linux
- Terminal Emulator: xterm
- Font: Inconsolata (Patched)
- Crate version: 0.7
- Backend: termion
-->

- OS:
- Terminal Emulator:
- Font:
- Crate version:
- Backend:

## Additional context
<!--
Add any other context about the problem here.
If you already looked into the issue, include all the leads you have explored.
-->
1 change: 1 addition & 0 deletions src/ratatui/.github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
32 changes: 32 additions & 0 deletions src/ratatui/.github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## Problem
<!--
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
-->

## Solution
<!--
A clear and concise description of what you want to happen.
Things to consider:
- backward compatibility
- ease of use of the API (https://rust-lang.github.io/api-guidelines/)
- consistency with the rest of the crate
-->

## Alternatives
<!--
A clear and concise description of any alternative solutions or features you've considered.
-->

## Additional context
<!--
Add any other context or screenshots about the feature request here.
-->
19 changes: 19 additions & 0 deletions src/ratatui/.github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Continuous Deployment

on:
push:
tags:
- "v*.*.*"

jobs:
publish:
name: Publish on crates.io
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_TOKEN }}
76 changes: 76 additions & 0 deletions src/ratatui/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: CI

env:
CI_CARGO_MAKE_VERSION: 0.35.16

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: ["1.59.0", "stable"]
include:
- os: ubuntu-latest
triple: x86_64-unknown-linux-musl
- os: windows-latest
triple: x86_64-pc-windows-msvc
- os: macos-latest
triple: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: hecrj/setup-rust-action@50a120e4d34903c2c1383dec0e9b1d349a9cc2b1
with:
rust-version: ${{ matrix.rust }}
components: rustfmt,clippy
- uses: actions/checkout@v3
- name: Install cargo-make on Linux or macOS
if: ${{ runner.os != 'windows' }}
shell: bash
run: |
curl -LO 'https://github.com/sagiegurari/cargo-make/releases/download/${{ env.CI_CARGO_MAKE_VERSION }}/cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
unzip 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
cp 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}/cargo-make' ~/.cargo/bin/
cargo make --version
- name: Install cargo-make on Windows
if: ${{ runner.os == 'windows' }}
shell: bash
run: |
# `cargo-make-v0.35.16-{target}/` directory is created on Linux and macOS, but it is not creatd on Windows.
mkdir cargo-make-temporary
cd cargo-make-temporary
curl -LO 'https://github.com/sagiegurari/cargo-make/releases/download/${{ env.CI_CARGO_MAKE_VERSION }}/cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
unzip 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
cp cargo-make.exe ~/.cargo/bin/
cd ..
cargo make --version
- name: "Format / Build / Test"
run: cargo make ci
env:
RUST_BACKTRACE: full

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
- name: Checkout
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Check conventional commits"
uses: crate-ci/committed@master
with:
args: "-vv"
commits: "HEAD"
- name: "Check typos"
uses: crate-ci/typos@master
6 changes: 6 additions & 0 deletions src/ratatui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target
Cargo.lock
*.log
*.rs.rustfmt
.gdb_history
.idea/
Loading

0 comments on commit 5a7fdef

Please sign in to comment.