feat: new <C-A> and <C-E> keybindings to select entire line for the input component (#2439)

This commit is contained in:
三咲雅 · Misaki Masa 2025-03-04 22:21:04 +08:00 committed by GitHub
parent 2d210ae557
commit 51de941f79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 35 deletions

View file

@ -176,6 +176,32 @@ jobs:
name: yazi-${{ matrix.arch }}.snap
path: yazi-${{ matrix.arch }}.snap
snap:
runs-on: ubuntu-latest
needs: [build-snap]
steps:
- uses: actions/download-artifact@v4
with:
pattern: yazi-*.snap
merge-multiple: true
- name: Setup snapcraft
run: sudo snap install --classic snapcraft
- name: Push snap to candidate channel
if: startsWith(github.ref, 'refs/tags/')
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
run: |
parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap
- name: Push snap to edge channel
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
run: |
parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap
draft:
if: startsWith(github.ref, 'refs/tags/')
permissions:
@ -232,29 +258,3 @@ jobs:
name: Nightly Build
body: ${{ env.NIGHTLY_BODY }}
target_commitish: ${{ github.sha }}
snap:
runs-on: ubuntu-latest
needs: [build-snap]
steps:
- uses: actions/download-artifact@v4
with:
pattern: yazi-*.snap
merge-multiple: true
- name: Setup snapcraft
run: sudo snap install --classic snapcraft
- name: Push snap to candidate channel
if: startsWith(github.ref, 'refs/tags/')
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
run: |
parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap
- name: Push snap to edge channel
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
run: |
parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap

View file

@ -237,9 +237,13 @@ keymap = [
{ on = "a", run = "insert --append", desc = "Enter append mode" },
{ on = "A", run = [ "move eol", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
{ on = "v", run = "visual", desc = "Enter visual mode" },
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Enter visual mode and select all" },
{ on = "r", run = "replace", desc = "Replace a single character" },
# Selection
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
{ on = "<C-A>", run = [ "move eol", "visual", "move bol" ], desc = "Select from EOL to BOL" },
{ on = "<C-E>", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
# Character-wise movement
{ on = "h", run = "move -1", desc = "Move back a character" },
{ on = "l", run = "move 1", desc = "Move forward a character" },

View file

@ -4,16 +4,15 @@ use yazi_shared::event::CmdCow;
use crate::input::{Input, InputMode, op::InputOp};
impl Input {
#[inline]
pub fn visual(&mut self, _: CmdCow) {
let snap = self.snap_mut();
if snap.mode != InputMode::Normal {
return;
} else if snap.value.is_empty() {
return;
if self.snap().mode != InputMode::Normal {
self.escape(());
}
snap.op = InputOp::Select(snap.cursor);
render!();
let snap = self.snap_mut();
if !snap.value.is_empty() {
snap.op = InputOp::Select(snap.cursor);
render!();
}
}
}

View file

@ -277,6 +277,8 @@ impl<'a> Executor<'a> {
}
}
InputMode::Insert => {
on!(visual);
on!(backspace);
on!(kill);
}