Skip to content

Commit

Permalink
Merge pull request #258 from kyoheiu/develop
Browse files Browse the repository at this point in the history
v2.11.0
  • Loading branch information
kyoheiu authored Dec 8, 2023
2 parents 19e64cc + e82b2ce commit 81494c2
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

## Unreleased

## v2.11.0 (2023-12-09)

### Added

- `<C-h>` for Backspace functionality after `i`, `I`, `c`, `/`, `:` and `z`.

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

### 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.2"
version = "2.11.0"
authors = ["Kyohei Uto <[email protected]>"]
edition = "2021"
description = "tui file manager with vim-like key mapping"
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ For more detailed document, visit https://kyoheiu.dev/felix.

## New release

## v2.11.0 (2023-12-09)

### Added

- `<C-h>` for Backspace functionality after `i`, `I`, `c`, `/`, `:` and `z`.
## v2.10.2 (2023-11-26)

### Fixed
Expand Down
1 change: 1 addition & 0 deletions src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ N :Go backward to the item that matches the keyword.
:q<CR> :Exit.
:{command} :Execute a command e.g. :zip test *.md
<Esc> :Return to the normal mode.
<C-h> :Works as Backspace after `i`, `I`, `c`, `/`, `:` and `z`.
ZZ :Exit without cd to last working directory
(if `match_vim_exit_behavior` is `false`).
ZQ :cd into the last working directory and exit
Expand Down
73 changes: 36 additions & 37 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1942,26 +1942,25 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
..
}) = 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,
kind: KeyEventKind::Press,
..
}) = event::read()?
{
if let Some(reg) = state.registers.check_reg(&code)
match (code, modifiers) {
(KeyCode::Char('r'), KeyModifiers::CONTROL) => {
if let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,
..
}) = event::read()?
{
if !reg.is_empty() {
let to_be_inserted = reg
.iter()
.map(|x| x.file_name.clone())
.collect::<Vec<String>>()
.join(" ");
for c in to_be_inserted.chars() {
if let Some(to_be_added) =
if let Some(reg) =
state.registers.check_reg(&code)
{
if !reg.is_empty() {
let to_be_inserted = reg
.iter()
.map(|x| x.file_name.clone())
.collect::<Vec<String>>()
.join(" ");
for c in to_be_inserted.chars() {
if let Some(to_be_added) =
unicode_width::UnicodeWidthChar::width(c)
{
if current_pos + to_be_added as u16
Expand All @@ -1973,33 +1972,32 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
current_char_pos += 1;
current_pos += to_be_added as u16;
}
}
go_to_info_line_and_reset();
print!(
":{}",
&command.iter().collect::<String>(),
);
move_to(current_pos, 2);
screen.flush()?;
continue;
} else {
continue;
}
go_to_info_line_and_reset();
print!(
":{}",
&command.iter().collect::<String>(),
);
move_to(current_pos, 2);
screen.flush()?;
continue;
} else {
continue;
}
} else {
continue;
}
}
}

match code {
KeyCode::Esc => {
(KeyCode::Esc, KeyModifiers::NONE) => {
go_to_info_line_and_reset();
hide_cursor();
state.move_cursor(state.layout.y);
break 'command;
}

KeyCode::Left => {
(KeyCode::Left, KeyModifiers::NONE) => {
if current_char_pos == 0 {
continue;
};
Expand All @@ -2014,7 +2012,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}

KeyCode::Right => {
(KeyCode::Right, KeyModifiers::NONE) => {
if current_char_pos == command.len() {
continue;
};
Expand All @@ -2029,7 +2027,8 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}

KeyCode::Backspace => {
(KeyCode::Backspace, KeyModifiers::NONE)
| (KeyCode::Char('h'), KeyModifiers::CONTROL) => {
if current_char_pos == 0 {
continue;
};
Expand All @@ -2049,7 +2048,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}

KeyCode::Char(c) => {
(KeyCode::Char(c), KeyModifiers::NONE) => {
if let Some(to_be_added) =
unicode_width::UnicodeWidthChar::width(c)
{
Expand All @@ -2071,7 +2070,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}

KeyCode::Enter => {
(KeyCode::Enter, KeyModifiers::NONE) => {
hide_cursor();
//Set the command and argument(s).
let commands: String = command.iter().collect();
Expand Down

0 comments on commit 81494c2

Please sign in to comment.