Skip to content

Commit 81494c2

Browse files
authored
Merge pull request #258 from kyoheiu/develop
v2.11.0
2 parents 19e64cc + e82b2ce commit 81494c2

File tree

6 files changed

+50
-39
lines changed

6 files changed

+50
-39
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
## Unreleased
66

7+
## v2.11.0 (2023-12-09)
8+
9+
### Added
10+
11+
- `<C-h>` for Backspace functionality after `i`, `I`, `c`, `/`, `:` and `z`.
12+
713
## v2.10.2 (2023-11-26)
814

915
### Fixed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "felix"
3-
version = "2.10.2"
3+
version = "2.11.0"
44
authors = ["Kyohei Uto <im@kyoheiu.dev>"]
55
edition = "2021"
66
description = "tui file manager with vim-like key mapping"

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ For more detailed document, visit https://kyoheiu.dev/felix.
2525

2626
## New release
2727

28+
## v2.11.0 (2023-12-09)
29+
30+
### Added
31+
32+
- `<C-h>` for Backspace functionality after `i`, `I`, `c`, `/`, `:` and `z`.
2833
## v2.10.2 (2023-11-26)
2934

3035
### Fixed

src/help.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ N :Go backward to the item that matches the keyword.
7474
:q<CR> :Exit.
7575
:{command} :Execute a command e.g. :zip test *.md
7676
<Esc> :Return to the normal mode.
77+
<C-h> :Works as Backspace after `i`, `I`, `c`, `/`, `:` and `z`.
7778
ZZ :Exit without cd to last working directory
7879
(if `match_vim_exit_behavior` is `false`).
7980
ZQ :cd into the last working directory and exit

src/run.rs

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,26 +1942,25 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
19421942
..
19431943
}) = event::read()?
19441944
{
1945-
// <C-r> to put the item name(s) in register
1946-
if modifiers == KeyModifiers::CONTROL
1947-
&& code == KeyCode::Char('r')
1948-
{
1949-
if let Event::Key(KeyEvent {
1950-
code,
1951-
kind: KeyEventKind::Press,
1952-
..
1953-
}) = event::read()?
1954-
{
1955-
if let Some(reg) = state.registers.check_reg(&code)
1945+
match (code, modifiers) {
1946+
(KeyCode::Char('r'), KeyModifiers::CONTROL) => {
1947+
if let Event::Key(KeyEvent {
1948+
code,
1949+
kind: KeyEventKind::Press,
1950+
..
1951+
}) = event::read()?
19561952
{
1957-
if !reg.is_empty() {
1958-
let to_be_inserted = reg
1959-
.iter()
1960-
.map(|x| x.file_name.clone())
1961-
.collect::<Vec<String>>()
1962-
.join(" ");
1963-
for c in to_be_inserted.chars() {
1964-
if let Some(to_be_added) =
1953+
if let Some(reg) =
1954+
state.registers.check_reg(&code)
1955+
{
1956+
if !reg.is_empty() {
1957+
let to_be_inserted = reg
1958+
.iter()
1959+
.map(|x| x.file_name.clone())
1960+
.collect::<Vec<String>>()
1961+
.join(" ");
1962+
for c in to_be_inserted.chars() {
1963+
if let Some(to_be_added) =
19651964
unicode_width::UnicodeWidthChar::width(c)
19661965
{
19671966
if current_pos + to_be_added as u16
@@ -1973,33 +1972,32 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
19731972
current_char_pos += 1;
19741973
current_pos += to_be_added as u16;
19751974
}
1975+
}
1976+
go_to_info_line_and_reset();
1977+
print!(
1978+
":{}",
1979+
&command.iter().collect::<String>(),
1980+
);
1981+
move_to(current_pos, 2);
1982+
screen.flush()?;
1983+
continue;
1984+
} else {
1985+
continue;
19761986
}
1977-
go_to_info_line_and_reset();
1978-
print!(
1979-
":{}",
1980-
&command.iter().collect::<String>(),
1981-
);
1982-
move_to(current_pos, 2);
1983-
screen.flush()?;
1984-
continue;
19851987
} else {
19861988
continue;
19871989
}
1988-
} else {
1989-
continue;
19901990
}
19911991
}
1992-
}
19931992

1994-
match code {
1995-
KeyCode::Esc => {
1993+
(KeyCode::Esc, KeyModifiers::NONE) => {
19961994
go_to_info_line_and_reset();
19971995
hide_cursor();
19981996
state.move_cursor(state.layout.y);
19991997
break 'command;
20001998
}
20011999

2002-
KeyCode::Left => {
2000+
(KeyCode::Left, KeyModifiers::NONE) => {
20032001
if current_char_pos == 0 {
20042002
continue;
20052003
};
@@ -2014,7 +2012,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20142012
}
20152013
}
20162014

2017-
KeyCode::Right => {
2015+
(KeyCode::Right, KeyModifiers::NONE) => {
20182016
if current_char_pos == command.len() {
20192017
continue;
20202018
};
@@ -2029,7 +2027,8 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20292027
}
20302028
}
20312029

2032-
KeyCode::Backspace => {
2030+
(KeyCode::Backspace, KeyModifiers::NONE)
2031+
| (KeyCode::Char('h'), KeyModifiers::CONTROL) => {
20332032
if current_char_pos == 0 {
20342033
continue;
20352034
};
@@ -2049,7 +2048,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20492048
}
20502049
}
20512050

2052-
KeyCode::Char(c) => {
2051+
(KeyCode::Char(c), KeyModifiers::NONE) => {
20532052
if let Some(to_be_added) =
20542053
unicode_width::UnicodeWidthChar::width(c)
20552054
{
@@ -2071,7 +2070,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20712070
}
20722071
}
20732072

2074-
KeyCode::Enter => {
2073+
(KeyCode::Enter, KeyModifiers::NONE) => {
20752074
hide_cursor();
20762075
//Set the command and argument(s).
20772076
let commands: String = command.iter().collect();

0 commit comments

Comments
 (0)