Skip to content

Commit

Permalink
Merge branch 'develop' into ctrl-h
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoheiu committed Dec 8, 2023
2 parents 92b105b + 5c0b7f8 commit 6e479e8
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 50 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## Unreleased

## v2.10.2 (2023-11-26)

### Fixed
- Added a filter to every user input to reject `Keyup` events. This is required on the windows platform.

## v2.10.1 (2023-11-02)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "felix"
version = "2.10.1"
version = "2.10.2"
authors = ["Kyohei Uto <[email protected]>"]
edition = "2021"
description = "tui file manager with vim-like key mapping"
Expand Down
35 changes: 6 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ For more detailed document, visit https://kyoheiu.dev/felix.

## New release

## v2.10.2 (2023-11-26)

### Fixed
- Added a filter to every user input to reject `Keyup` events. This is required on the windows platform.


## v2.10.1 (2023-11-02)

### Fixed
Expand All @@ -37,35 +43,6 @@ For more detailed document, visit https://kyoheiu.dev/felix.
- Add `has_bat` field to `State`.
- Add `FxError::InvalidPath` to handle invalid unicode in file path.

## v2.9.0 (2023-10-22)

### Added
- Change color of untracked/changed files or directories containing such files. Default color is Red(1). You can change it in the config file.
- Add `git2`.

### Fixed
- Explicitly ignore the key release events for Windows.

## v2.8.1 (2023-08-25)

### Fixed
- Fix help text.

## v2.8.0 (2023-08-25)

### Added
- `i{file name}<CR>` to create new file, and `I{dir name}<CR>` to create new directory.
- If zoxide is installed, whenever changing directory inside felix, `zoxide add` will be executed to add the directory or increment its rank in the zoxide database.
- For this, `State` now has a new field `has_zoxide`, which is checked at startup.

### Changed
- config's `color` is now optional: By this, all config fields are optional.
- Remove warning message when you launch felix without the config file.
- When opening file by default editor is failed, felix displays more accurate warning: `$EDITOR may not be set, or config file may be invalid.`.

### Removed
- Remove `syntect` and syntax highlighting in the preview area. This will improve build and start-up times, and resolve the handling of wide chars such as CJK.

For more details, see `CHANGELOG.md`.

<a id="status"></a>
Expand Down
Binary file modified screenshots/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ impl Default for Config {

fn read_config(p: &Path) -> Result<Config, FxError> {
let s = read_to_string(p)?;
read_config_from_str(&s)
}

fn read_config_from_str(s: &str) -> Result<Config, FxError> {
let deserialized: Config = serde_yaml::from_str(s)?;
let deserialized: Config = serde_yaml::from_str(&s)?;
Ok(deserialized)
}

Expand Down
31 changes: 19 additions & 12 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
show_cursor();
screen.flush()?;

if let Event::Key(KeyEvent { code, .. }) = event::read()? {
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) = event::read()? {
match code {
KeyCode::Char('g') => {
hide_cursor();
Expand All @@ -414,7 +414,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
show_cursor();
screen.flush()?;

if let Event::Key(KeyEvent { code, .. }) = event::read()? {
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) = event::read()? {
match code {
KeyCode::Char('g') => {
hide_cursor();
Expand Down Expand Up @@ -630,7 +630,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
let mut current_pos = 3;
'zoxide: loop {
if let Event::Key(KeyEvent {
code, modifiers, ..
code, modifiers, kind: KeyEventKind::Press, ..
}) = event::read()?
{
match (code, modifiers) {
Expand Down Expand Up @@ -794,13 +794,14 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
let mut current_char_pos = 0;
'insert: loop {
if let Event::Key(KeyEvent {
code, modifiers, ..
code, modifiers,
kind: KeyEventKind::Press, ..
}) = event::read()?
{
match (code, modifiers) {
// <C-r> to put the item name(s) from register
(KeyCode::Char('r'), KeyModifiers::CONTROL) => {
if let Event::Key(KeyEvent { code, .. }) =
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) =
event::read()?
{
if let Some(reg) =
Expand Down Expand Up @@ -1072,7 +1073,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
show_cursor();
screen.flush()?;

if let Event::Key(KeyEvent { code, .. }) = event::read()? {
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) = event::read()? {
match code {
KeyCode::Char('d') => {
if let Err(e) =
Expand Down Expand Up @@ -1178,7 +1179,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
let mut current_char_pos = rename.len();
loop {
if let Event::Key(KeyEvent {
code, modifiers, ..
code, modifiers, kind: KeyEventKind::Press, ..
}) = event::read()?
{
match (code, modifiers) {
Expand Down Expand Up @@ -1316,7 +1317,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
let mut current_char_pos = 0;
loop {
if let Event::Key(KeyEvent {
code, modifiers, ..
code, modifiers, kind: KeyEventKind::Press, ..
}) = event::read()?
{
match (code, modifiers) {
Expand Down Expand Up @@ -1523,7 +1524,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {

let mut current_pos = INITIAL_POS_COMMAND_LINE;
'reg: loop {
if let Event::Key(KeyEvent { code, .. }) = event::read()? {
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) = event::read()? {
match code {
KeyCode::Esc => {
go_to_info_line_and_reset();
Expand Down Expand Up @@ -1901,14 +1902,14 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
let mut current_char_pos = 0;
'command: loop {
if let Event::Key(KeyEvent {
code, modifiers, ..
code, modifiers, kind: KeyEventKind::Press, ..
}) = event::read()?
{
// <C-r> to put the item name(s) in register
if modifiers == KeyModifiers::CONTROL
&& code == KeyCode::Char('r')
{
if let Event::Key(KeyEvent { code, .. }) =
if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) =
event::read()?
{
if let Some(reg) = state.registers.check_reg(&code)
Expand Down Expand Up @@ -2244,7 +2245,13 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
show_cursor();
screen.flush()?;

if let Event::Key(KeyEvent { code, .. }) = event::read()? {
let mut next_key:Event = event::read()?;
// ignore exactly one keypress Release after a Z is entered
if let Event::Key(KeyEvent { kind: KeyEventKind::Release, .. }) = next_key {
next_key = event::read()?;
}

if let Event::Key(KeyEvent { code, kind: KeyEventKind::Press, .. }) = next_key {
match code {
KeyCode::Char('Q') => {
if state.match_vim_exit_behavior
Expand Down
15 changes: 13 additions & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::session::*;
use super::term::*;

use chrono::prelude::*;
use crossterm::event::KeyEventKind;
use crossterm::event::{Event, KeyCode, KeyEvent};
use crossterm::style::Stylize;
use log::{error, info};
Expand Down Expand Up @@ -1398,7 +1399,12 @@ impl State {

let mut skip = 0;
loop {
if let Event::Key(KeyEvent { code, .. }) = crossterm::event::read()? {
if let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,
..
}) = crossterm::event::read()?
{
match code {
KeyCode::Char('j') | KeyCode::Down => {
clear_all();
Expand Down Expand Up @@ -1432,7 +1438,12 @@ impl State {
print_warning(EMPTY_WARNING, self.layout.y);
screen.flush()?;

if let Event::Key(KeyEvent { code, .. }) = crossterm::event::read()? {
if let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,
..
}) = crossterm::event::read()?
{
match code {
KeyCode::Char('y') | KeyCode::Char('Y') => {
print_info("EMPTY: Processing...", self.layout.y);
Expand Down

0 comments on commit 6e479e8

Please sign in to comment.